Reputation: 579
I'm having a bit of trouble with my mod_rewrite, I had this running perfectly fine on my previous litespeed VPS. Now I'm using my own dedicated server running CentOS 6, so I don't know if I haven't configured correctly.
This is how it currently looks:
http://***.com/?pageName=FourthPage
This is how I want it to look:
http://***.com/FourthPage
This is my current .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^([^/\.]+)/?$ index.php?pageName=$1
Upvotes: 0
Views: 62
Reputation: 42984
I am not good with htaccess syntax. Configuring such rules should be done directly in the server configuration if you have access. Using htaccess for such purposes is only a workaround. However:
The pattern inside the RequestRule is wrong. Especially the trailing slash ('/'). What is it meant to match? You might want to read again through the documentation of that rule. The pattern is not matched against a full URL but only against a part of the path in case of htaccess.
Have a try with the following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)$ index.php?pageName=$1
Also you should enable rewrite logging inside the server. The relevant configuration options are RewriteLog (for the file) and RewriteLogLevel (well, for the level...). It help to understand what is going on inside the rewrite module. However that cannot be done in htaccess too, you need access to the servers general configuration.
Upvotes: 1