Forum Moderators: phranque
[edited by: incrediBILL at 9:34 pm (utc) on Oct 7, 2012]
[edit reason] fixed URLS, use Example.com [/edit]
href="www.example.com/book/name/motor_car" from the pages of your site and add a RewriteRule to match those requests to the actual internal filepath that will serve the content. RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [edited by: incrediBILL at 9:35 pm (utc) on Oct 7, 2012]
[edit reason] fixed URLS, use Example.com [/edit]
You should make a sticky thread with a few of the examples of a rewrite...just a thought
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^book/([0-9]+) /book.php?name=$1 [L] RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [edited by: incrediBILL at 9:38 pm (utc) on Oct 7, 2012]
[edit reason] removed URLS, see TOS & Charter [/edit]
RewriteCond %{REQUEST_FILENAME}\.php -f example.com/book/78456, only if there's a physical file on the server called 78456.php then rewrite the original request to fetch content from /book.php/name=78456
^book/([0-9]+) Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^book/([-a-zA-Z0-9_]+) /book.php?name=$1 [L] RewriteCond %{REQUEST_URI} !(\.gif|\.jpg|\.png|\.css)$
!\.(gif|jpe?g|png|css)$ ^book/([a-z0-9-]+) They disappear in underlined links, what does this mean?
RewriteRule ^(.*)/(.*)/images/$ ../images/ I think another rewrite is called for images:
RewriteRule ^(.*)/(.*)/images/$ ../images/
Do you think this would be appropriate?
I'll have a sift through this:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/page\.php$
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^(.*)$ http://mydomain.site/page/%1.pdf [R=302,L] RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^page\.php$ http://mydomain.site/page/%1.pdf [R=302,L]