I have the following .htaccess file.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^awesomeslash/ /somepage.php [NC,PT]
RewriteRule ^([^/\.]*)/?([^/\.]*)/?([^/\.]*)/?$ /template2.php?slash1=$1&slash2=$2&slash3=$3 [L]
I’ve running into a problem with the rule:
RewriteRule ^awesomeslash/ /somepage.php [NC,PT]
When I go to http://www.mysite.com/awesomeslash/
It is not loading somepage.php instead it is following the run under it and going to template2.php
Firstly: This does not make much sense if you want rewrite
/awesomeslash/to/somepage.php:I assume you wanted this instead:
Secondly:
You need
Lflag next to[NC,PT]:[NC,PT,L]— this will tell Apache to not to process other rules.You also need to add
$at the end of match pattern to make the rule match only this URL and not/awesomeslash/something-else.RewriteRule ^awesomeslash/$ /somepage.php [NC,PT,L]