1

Hi guys I a major issue with url rewrite. Apologizes if you might have seen this somewhere before.

issue here

If i enter a url for example exampl.x10.mx OR www.example.x10.mx I get a 403 error which shouldnt happen because

RewriteCond %{HTTP_HOST} ^example.x10.mx [NC]
RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [R=301,L]

is MIGHT to take care of that.

RewriteCond %{REQUEST_URI} !^lwh/

RewriteCond $1 !^lwh/

The code above hiden the lwh folder.

FULL .htaccess CODE

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_URI} !^lwh/
RewriteCond $1 !^lwh/
RewriteCond %{HTTP_HOST} ^example.x10.mx [NC]

RewriteRule (.*) /lwh/main/pages/general/$1 [L]
RewriteRule ^(.*)$ lwh/$1 [L]
RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [R=301,L]

Summary of the problem If i remember

  RewriteCond %{REQUEST_URI} !^lwh/
    RewriteRule ^(.*)$ lwh/$1 [L]

the code below works and the same happens if i remember the code below. The thing is I need both of them.

RewriteCond %{HTTP_HOST} ^example.x10.mx [NC]
RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [R=301,L]

An idea why this is happening please

6
  • Can you write something about your actual requirements also like what are you trying to do.
    – anubhava
    Commented Jul 22, 2013 at 18:39
  • @anubhava please looks at the issue here Commented Jul 22, 2013 at 19:18
  • Your link didn't get posted.
    – anubhava
    Commented Jul 22, 2013 at 19:28
  • You wrote: anubhava please looks at the issue here I'm not sure what that means.
    – anubhava
    Commented Jul 22, 2013 at 19:45
  • its not a link its in the question... look for issue here in the question Commented Jul 22, 2013 at 19:48

2 Answers 2

1

Replace your .htaccess with this code:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.x10\.mx$ [NC]
RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [R=302,L]

RewriteCond %{REQUEST_URI} !^/lwh/
RewriteCond %{HTTP_HOST} ^example\.x10\.mx$ [NC]
RewriteRule ^(.*)$ /lwh/main/pages/general/$1 [L]
4
  • I am having probelm with the url redirect and if u type www.example.x10.mx Commented Jul 22, 2013 at 20:10
  • Sorry, no matter how much I tried to decipher your problem its clear I'm no where close. Please state your problem clearly then I will make another attempt.
    – anubhava
    Commented Jul 22, 2013 at 20:21
  • RewriteCond %{HTTP_HOST} ^lwhitneyhair\.x10\.mx$ [NC] RewriteRule ^(.*)$ http://www.lwhitneyhair.x10.mx/$1 [R=301,L] is not doing what it should do. RewriteCond %{REQUEST_URI} !^/lwh/ RewriteCond %{HTTP_HOST} ^example\.x10\.mx$ [NC] is doing his job. the problem is why isn't RewriteCond %{HTTP_HOST} ^lwhitneyhair\.x10\.mx$ [NC] RewriteRule ^(.*)$ http://www.lwhitneyhair.x10.mx/$1 [R=301,L] doing what it should so Commented Jul 22, 2013 at 20:39
  • yes I when back and read what it meant R=301 (permanent redirect to new URL) Commented Jul 22, 2013 at 21:50
1

The problem was with the R=301 (permanent redirect to new URL)

Before

RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [R=302,L]

now

RewriteRule ^(.*)$ http://www.example.x10.mx/$1 [L]

Not the answer you're looking for? Browse other questions tagged or ask your own question.