: Apache .htaccess URL rewriting is not working I am using this code in .htaccess but the last line not giving any response: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
I am using this code in .htaccess but the last line not giving any response:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ user_pro.php?id= [QSA,L]
RewriteRule ^(.*)$/images image.php?id= [QSA,L] #this line not giving any response
More posts by @Moriarity557
2 Comments
Sorted by latest first Latest Oldest Best
the $ anchor signals the end of the subject (as ^ signals the start), thus your expr is incorrect.
What you're lookng for is more likely something like
# to rewrite images/foo to image.php?id=foo
RewriteRule ^images/(.*)$ image.php?id= [QSA,L]
# to rewrite foo/images to image.php?id=foo
RewriteRule ^(.*)/images$ image.php?id= [QSA,L]
For more info have a look at mod_rewrite intro and the mod_rewrite documentation
First, make sure mod_rewrite is on:
*https://httpd.apache.org/docs/current/mod/mod_rewrite.html*
If you're on a linux machine like Centos, you can check by running
httpd -l to list compiled (installed) modules. stackoverflow.com/questions/7337724/how-to-check-whether-mod-rewrite-is-enable-on-server
Lastly, are you including RewriteEngine on at the beginning of your code?
Try :
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ user_pro.php?id= [QSA,L]
RewriteRule ^(.*)$/images image.php?id= [QSA,L]
I'm not really familiar with the syntax, so I can't tell you whether ^(.*)$/images image.php?id= [QSA,L] is proper or not.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.