Maybe just a tricky question,
But for my website, I use to hide files extensions in url using this line in my .htaccess :
RewriteEngine On
RewriteRule ^(.+)/$ $1.php [L]
It worked perfectly on my mutualized server, but not in local with MAMP. But it was not a big deal.
But now I've chosen a dedicated server, and I'm having the real problem, not working on it. It's strange because other rewriting rules like:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_]+)$ place.php?place=$1 [L]
RewriteRule ^([a-zA-Z0-9_]+)/$ place.php?place=$1 [L]
are perfectly working!!
Is there a specific configuration to be made in some Apache file in order to have this thing working?
Thanx a lot for your time
Guillaume
EDIT : More of my .htaccess :
RewriteEngine On
RewriteRule ^(.+)/$ index.php?$1 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)$ place.php?place=$1 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)/$ place.php?place=$1 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ fullscreen.php?place=$1&event=$2 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)/$ fullscreen.php?place=$1&event=$2 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)$ fullscreen.php?place=$1&event=$2&sort=$3 [L]
RewriteRule ^fullscreen-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)-([a-zA-Z0-9_]+)/$ fullscreen.php?place=$1&event=开发者_StackOverflow$2&sort=$3 [L]
check for the mod_rewrite
if it is enable with php
by doing
echo phpinfo();
so you have to enable mod_rewrite
in httpd.conf
file
- Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines) if you have LAMP platform file can be found here /etc/httpd/conf/httpd.conf
- Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line)
- Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.
http://www.tutorio.com/tutorial/enable-mod-rewrite-on-apache
enabled overriding ( AllowOverride All
) in your httpd.conf
Needed That:
Options +FollowSymlinks
Options +MultiViews
精彩评论