Forum Moderators: phranque
I Really need your help about mod rewrite. this part is always be my weakness. :(
Basiacally i want to hide 'qq' varible name:
http://www.example.com/?qq=keyword
to just
http://www.example.com/keyword
so it still pass keyword to 'qq' variable
I have already make a htaccess rule but it seems not working
#Options +FollowSymLinks
RewriteEngine on
#RewriteBase /
RewriteRule ^(.*)$ ?qq=$1 [L]
and i dont know how to send all value after '/' to qq variable except filename.. so filename request will be processed normally
Anyone can Help with this?
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^(([^/]+/)*[^.]+)$ ?qq=$1 [L]
Note that all images and included objects on your pages will need to use server-relative or canonical URLs. For example, refer to images as <img src="/images/logo.gif"> or <img src="http://www.example.com/images/logo.gif"> instead of <img src="images/logo.gif">
Once you get that working, you may wish to add a second rule to *redirect* direct client requests for the old dynamic URLs to the new static/SEO-friendly URLs.
Jim
it works.. but i'm still dont understand with this part:
Note that all images and included objects on your pages will need to use server-relative or canonical URLs. For example, refer to images as <img src="/images/logo.gif"> or <img src="http://www.example.com/images/logo.gif"> instead of <img src="images/logo.gif">
why i need to change it to use '/' infront all of them?.. but it seems work fine without that slash..
and is it (/) also must be used in php script at 'include' part?
BTW, what code to use if i want to redirect old url to the new one?
example.com/search/keyword (old)
to this new one
example.com/keyword
currently i'm uplace this htaccess to /search folder
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://example.com/$1 [R]
is is OK/ correct?
Thnaks
No, because "include" is a *file* include, and does not make use of HTTP transfers. Therefore, .htaccess has no effect on "include."
The code you posted in your last post has nothing to do with your original question, so I can't say if it is "OK" or not. It is a 302 redirect, and is missing the [L] flag. That is all I can say.
Jim