I'm looking to get Apache 2.2 mod_rewrite to obtain clean web addresses. I've links for example
<ul> <li><a href="index.php?view=pageName">Page Name</a></li> <li><a href="index.php?view=pageName2">Page Name2</a></li> <li><a href="index.php?view=pageName3">Page Name3</a></li> </ul>
and url arrives to become
I must clean the url within the address bar it for this
Edit: This really is what's during my httpd.conf whether it's any use.
<Directory "C:/Apache2.2/htdocs/user"> Options Indexes FollowSymLinks AllowOverride all order allow,deny Allow from all </Directory>
Using phpinfo() I've verified that mod_rewrite is loaded and that i have this during my .htaccess (user file, Not root .htaccess) and never virtual user on apache
RewriteEngine on RewriteBase /user/ #Edited rewrite base added in, but not helping much. RewriteOptions Inherit RewriteRule ^/user/([a-zA-Z])/?$ index.php?view=$1 [NC,L]
Edit: the relaxation of my .htaccess
#Ensure browser reads Header Header unset ETag FileETag None Header unset Last-Modified #Set caching expires Header set Expires On ExpiresDefault "access plus 30 days" #gzip <FilesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </FilesMatch>
doesn't work exactly the same on all menu links that are identical in html structure, and never working correctly. IE: It transmits me to
http://example.com/user/?view=pageName, but is loading the main HTML file content.
Basically change this line
RewriteRule ^/user/([a-zA-Z])/?$ index.php?view=$1 [NC,L]
RewriteRule ^index\.php$ http://www.google.com [NC,L]
I recieve delivered to google not surprisingly. So clearly I have to do a problem using the matching and changing, but what shall we be held doing wrong? Thanks ahead of time.
Edit: access.log and error.log are error free.
RewriteRule ^/user/([a-zA-Z]+)?$ index.php?view=$1 [NC,L]
you're missing the + so you aren't matching words, only a single char
RewriteRule ^/user/([a-zA-Z])?$ index.php?view=$1 [NC,L]
do this..(one slash removed)
Fixed: Needed to change HTML URL style for use as a result
<a href="pageName">Page Name</a>
RewriteEngine On RewriteOptions Inherit ReWriteBase /user/ RewriteRule ^([a-zA-Z0-9]+)/?$ index.php?view=$1 [QSA,L]
Also needed to disable mod_cache.so from apache's httpd.conf because it hinder rewrite if you will find any caches left out. Hope this can help others to obtain clean web addresses working.