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>

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

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

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"

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...

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 :)

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

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]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.