We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,521 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

.htaccess file causing internal server error

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>

3
Contributors
7
Replies
2 Days
Discussion Span
6 Months Ago
Last Updated
11
Views
DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0

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

pritaeas
Posting Prodigy
Moderator
9,534 posts since Jul 2006
Reputation Points: 1,194
Solved Threads: 1,494
Skill Endorsements: 98

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

DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 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"

gon1387
Posting Whiz in Training
233 posts since Jan 2011
Reputation Points: 32
Solved Threads: 37
Skill Endorsements: 3

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

DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 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 :)

DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 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

DaveyMoyes
Junior Poster
122 posts since May 2009
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 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]
gon1387
Posting Whiz in Training
233 posts since Jan 2011
Reputation Points: 32
Solved Threads: 37
Skill Endorsements: 3

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.1003 seconds using 2.69MB