htaccess URL rewrite: What am I messing up in the code?


I have the following rewrite rule:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} Catalog\/(string|page)\/
RewriteRule ^Catalog\/(string|page)\/([^\/]+)\/[^\.]+\.html$  Catalog/Catalog.php?$1=$2

RewriteRule is on one line but may be showing on multiple lines here.

My questions is mainly what am I doing wrong. I am not getting any errors so Rewrite is working. The address I am typing in to the browser is and what I was hoping to get is

I am guessing my regex is messed up but have not been able to get it right.


I think that the first wrong thing is putting point without backslash before (.) => www.

 ^www\.([^/])/Catalog/([a-zA-Z0-9]+)/([a-zA-Z0-9_]+).html$ www.$1/Catalog/Catalog.php?string=$2

here is a clear example:

RewriteRule ^*)$ /mirror/of/remotesite/$1

check this out:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^Catalog/(.+)/(.+)\.html$ /Catalog/Catalog.php?$1=$2

you should restart your apache server -if it's a local server- (start and stop) and you must be able to access http://localhost/Catalog/string/RT.html

This video can help you solving your question :)
By: admin