| 4:41 pm on Oct 28, 2003 (gmt 0)|
|2.) Do I have to change the links manually on my site from http://www.mydomain.com/results.php3?term=search_term to http://www.mydomain.com/search_term.html OR will it be done automatically. |
Yes, anything that feeds URLs to the browser should be changed to specify the new short URL, and then let mod_rewrite translate that short URL back into the long one if it is required for input by your script.
| 4:53 pm on Oct 28, 2003 (gmt 0)|
Thanks for the replies. I am looking at site point article right now.
JD any thoughts on question No. 1
| 5:17 pm on Oct 28, 2003 (gmt 0)|
This is the first thing I would try but I haven't tested it ("Options +MultiViews" means you don't have to add .html to your search term)
Options +FollowSymlinks +MultiViews
RewriteRule (.*) results.php?term=$1 [L]
| 9:49 am on Oct 29, 2003 (gmt 0)|
Tried everything, but so far no luck. Now my .htaccess looks like this
RewriteRule ^(.*)mod/(.*)\.html$ http://www.mydomain.com/results.php3?term=$2 [R=301,L]
I am testing it in a subdirectory so that I dont mess up with my main site.
Please correct me if I am wronge. In my opinion the above should convert any URLS even non existing to the later one.
If someone tries for
It should be converted to
Instead of doing this the URL it is picking up is my 404 page.
Thanks for helping me out.
| 6:46 pm on Oct 29, 2003 (gmt 0)|
Finally successful, the final code looks like this
RewriteRule (.*).html$ http://www.mydomain.com/results.php3?term=$1 [R=301,L]
Now when I try to access http://www.mydomain.com/mod/anything.html it automatically transfers me to http://www.mydomain.com/results.php3?term=anything
Now coming back to the small hitch
The URL in the browser also displays as http://www.mydomain.com/results.php3?term=anything
Is there any way that the URL remains the same as http://www.mydomain.com/mod/anything.html
| 6:53 pm on Oct 29, 2003 (gmt 0)|
RewriteRule (.*)\.html$ /results.php3?term=$1 [L]