Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess with pagination in php?
    primarykey
    data
    text
    <p>I am currently coding a pagination script into many parts of my site, this has been a well needed and requested feature and I have finally been able to come round and start coding it, it is all going well, until I find that my rewritten urls don't like working with the pagination urls.</p> <p>So, an example page on my site would be news.php. This file structure can be something like news.php?id=5. I have rewritten the url like so:</p> <p>/news/5/ </p> <pre><code>## Rewrite URL's for News &amp; Dev ## RewriteRule ^news/([0-9]+)/$ /news.php?id=$1 [L] RewriteRule ^news/([0-9]+)$ /news.php?id=$1 [L] RewriteRule ^news$ /news.php [L] RewriteRule ^news/$ /news.php [L] </code></pre> <p>The pagination script I am using prepends two new variables in the url, the new url turns out to be this:</p> <pre><code>news.php?page=1&amp;ipp=55id=5 </code></pre> <p>I would really appreciate it if anyone could assist me in making the urls look better, as it defeats the object of having it in the first place if after they use the pagination, it changes the url back to a clunky and ugly url.</p> <p>I don't want it to be required to have parts of the url, that is something I really don't want..</p> <p>e.g I don't want the url to be required to be /news/1/55/5, instead id like it to be optional.</p> <p>Thank you for your time, it is appreciated!</p> <p><strong>Additional Information</strong></p> <p>The links in my news script currently display like so:</p> <pre><code> news.php?page=1&amp;ipp=55id=5 </code></pre> <p>I don't like to see ugly urls like that, and want to make the url look better using mod_rewrite, It would be better if the urls would display like so:</p> <pre><code>/news/PAGE/IPP/ID/ -&gt; return news.php?page=1&amp;ipp=55id=5 </code></pre> <p>Also, to make it as user friendly as possible, I don't want any of the fields to be required as such, so for example I would like to have the following link accessible at all times without it requiring the other fields.</p> <pre><code>/news/ID/ </code></pre> <p>Then, when the user clicks a pagination link, it would use the following link structure:</p> <pre><code>/news/PAGE/IPP/ID/ -&gt; return news.php?page=1&amp;ipp=55id=5 </code></pre> <p>This is all from user feedback of my site, and is something that people have been asking for. Problem is, I don't understand even simple .htaccess</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload