1

Motive: What I am trying to do is use parked domain and redirect it to subdirectory. and in subdirectory I have a script that needs pretty url's and htaccess is the only thing I can use.

Code in main .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteBase /
RewriteRule ^info/(.+)$ contact.php?a=$1
RewriteRule ^list/(.+)/page/(.+)$ list.php?a=$1&p=$2 [L]
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteRule ^(.*)$ http://www.example.com/m/$1 [R=301]

Code in /m .htaceess

RewriteEngine On
RewriteBase /
RewriteRule ^how/(.+)$ how.php?a=$1
RewriteCond %{HTTP_HOST} ^(www.)?main-example.com$ [NC]
RewriteCond %{REQUEST_URI} ^/m/(.*)$
RewriteRule ^(.*)$ - [L,R=404]

What i want is to achieve when user visits www.example.com/m/how/love the script should treet a get variable of a something like www.example.com/m/how.php?a=love but url should remain pretty. What my current code does is unlimited redirects to /m/404.shtml giving 301 in firebug.

IdidntKnewIt
  • 572
  • 6
  • 23
  • What are you trying with this statement: `RewriteCond %{REQUEST_URI} ^/m/(.*)$`? – hjpotter92 Nov 23 '14 at 10:23
  • `http://www.example.com/m/404.shtml` matches the last rule in the top code block. I believe as you use a redirect code that won't stop rewriting, but instead redirect to the same page. Also: http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained – Sumurai8 Nov 23 '14 at 11:22
  • @hjpotter92 read the cond before it, it is meant to be used when directory is viewed using main domain and not parked one. Then it will throw a 404. – IdidntKnewIt Nov 23 '14 at 12:29

0 Answers0