Forum Moderators: phranque
RedirectMatch 301 (.*)\.php$ http://www.example.com$1.html
However I want to change all strings like this:
www.example.com/links/add.php?cat=42&ma=1
www.example.com/links/add.php?cat=44&ma=1
www.example.com/links/add.php?cat=53&ma=1
to turn in to this:
www.example.com/links/add/cat/42.html
www.example.com/links/add/cat/44.html
www.example.com/links/add/cat/53.html
How can I do that? I don't have any codes!
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /add\.php\?links=([^&]+)&add=([^&]+)&cat=([^&]+)&num=([^&]+)\ HTTP/
RewriteRule ^add\.php$ http://www.example.com/links/%1/%2/%3/[R=301,L]
[edited by: texanweb at 3:08 am (utc) on April 23, 2006]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /add\.php\?links=([^&]+)&add=([^&]+)&cat=([^&]+)&num=([^\ ]+)\ HTTP/
RewriteRule ^browse\.php$ http://www.example.com/links/%1/%2/%3/ [R=301,L]
Just wondering, where is it telling the browser to convert it to .html?
I think the post I cited above covered this subject fairly thoroughly... If you want to change the links you publish, change your pages. Then use mod-rewrite to convert the URLs in those links, when requested from your server, back into the form needed to run your script.
Jim
Eg. www.host.com/index.php?user=1
after mod rewrite, whixh looks like this:
Options +FollowSymLinks
RewriteEngine On
# Internally rewrite search engine friendly static URL to dynamic filepath and query
RewriteRule ^(.*)/index.html sitemap.php?num=$2&page=$1 [L,NC]
# Externally redirect client requests for old dynamic URLs to equivalent new static URLs
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\?user=([^\]+)\ HTTP/
RewriteRule ^index.php$ [%{HTTP_HOST}...] [R=301,L]
I get www.host.com/1/index.html?user=1
The problem is I want to get rid of the value and I have no idea where it is getting it from if i specifically redirect to index.html?
Thanks for your help,
Solitary