1.11M Members

.htaccess file causing internal server error

 
0
 

Hi Everyone.
I have a htaccess file the re-writes my urls for a directory on a website I am helping to develop for a friend.
the directory structure is mydomain.co.uk/dir1/dir2/shopping-cart/
The mod_rewrite rule rewrites the index.php file into pretty urls
for example:
shopping-cart/123/this-is-the-item-title

The problem I am facing is when we try and use the same htaccess for the mobile side
we get the internal server error.

The directory structure is the same for the mobile as it is for the desktop
Any help would be appreciated as we have been digging around for a few days now.

Here is the htaccess mod_rewrite condition we are using

<IfModule mod_rewrite.c>  RewriteEngine on  RewriteCond %{HTTP_HOST} !^(www\.|m\.)?mydomain\.co\.uk  RewriteRule ^(\d+)/([^/]+)/?$ index.php?uiid=$1&title=$2 [L] </IfModule>

 
0
 

I don't see any obvious issues. In my experience the internal server error is usually caused by typos, or unsupported features.

 
0
 

Hi Pritaeas thanks for replying,
I have looked into the server error logs and that is indeed what it mentions.

The funny thing is the .htaccess file works for the website, I just get the error what viewing the mobile website url.

The error log does give some indication to why it produces the internal server error.

/m/webstores/ecommerce/shopping-cart/.htaccess: Invalid command '\xa0RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

the only issue I see here is the path /m/webstores/ etc
it is missing out the domain name as it should read /m/domainname.com/webstores etc

Any ideas to why it would be doing this ?
Thanks

 
0
 

Should an invalid character of "\xa0" be there or we can simply use space "\x20"? or maybe the mod rewrite's not enabled? Although obviously it came right through "<IfModule mod_rewrite.c>"

Anyhow, can you check if this runs... withtou the "<IfModule mod_rewrite.c>"

RewriteEngine on  
RewriteCond %{HTTP_HOST} !^(www\.|m\.)?mydomain\.co\.uk  
RewriteRule ^(\d+)/([^/]+)/?$ index.php?uiid=$1&title=$2 [L]

Paste this in notepad to remove any formating, and remove any whitespace before "RewriteEngine on"

 
0
 

Hi Gon1387 - Just going to give this a try to see if it runs or not -
The '\xa0RewriteEngine' is inside the server error log & I have no idea what it is...

I will let you know if what you have suggested works
Thanks for replying...

 
0
 

Hi Gon1387 - I have just tried what you suggested and I now get a 404 error -
But the page is clearly there ?
This is driving me nuts :)

 
0
 

The full 404 error reads -
/webstores/ecommerce/shopping-cart etc etc
but the full url is / should be
http://m.domainname.com/webstores/ecommerce/shopping-cart

then the mod_rewrite should kick in and change the url from index.php?id=123&title=title of product
to http://m.domainname.com/webstores/ecommerce/shopping-cart/123/title-of-product

I am using the slugify script to make my urls as title-of-product but for some reason it doesnt like it on the mobile device

 
0
 

you got to add "webstores/ecommerce/shopping-cart" too.. before getting your classes

# your rewriterule should be like this
    RewriteRule webstore/exommerce/shopping-cart/(\d+)/([^/]+)/?$ index.php?uiid=$1&title=$2 [L]
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: