0

I have it working on localhost, as well as on a free hosting service I test things on, but on godaddy it won't work!

In my root directory, I have a folder called blog and inside there is a file called article.php

My htaccess should rewirte

http://www.bragdeal.com/blog/article.php?id=9 to http://www.bragdeal.com/blog/article/9

and

http://www.bragdeal.com/blog/index.php?page=2 to http://www.bragdeal.com/blog/page/2

Options -Indexes -MultiViews +FollowSymlinks
RewriteEngine On
RewriteBase /

AddDefaultCharset utf-8
SetEnv SERVER_ADMIN support@bragdeal.com
FileETag none

#force HTTP
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#article id
RewriteCond %{THE_REQUEST} /blog/article\.php\?id=([^\s&]+) [NC]
RewriteRule ^ blog/article/%1? [R=302,L]
RewriteRule ^blog/article/([^/.]+)/?$ blog/article.php?id=$1 [L,QSA,NC]

#page number
RewriteCond %{THE_REQUEST} /blog/index\.php\?page=([^\s&]+) [NC]
RewriteRule ^ blog/page/%1? [R=302,L]
RewriteRule ^blog/page/([^/.]+)/?$ blog/index.php?page=$1 [L,QSA,NC]


#------------------ remove index.php ---------------------------------
RewriteCond %{THE_REQUEST} /(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule ^ %1 [R=302,L,NE]

# remove /index
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index($|\ |\?)
RewriteRule ^ /%1 [R,L]


#-------------------remove .php-----------------------------------------   
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]

Why is it not working on godaddy's hosting? I literally copied all my files from localhost to godaddy expecting it to be identical

BragDeal
  • 748
  • 2
  • 10
  • 25
  • "Not working" is insufficient to diagnose anything. Showcase error.log / access.log, enable the RewriteLog, and/or make a screencast. – mario Jul 25 '15 at 23:22
  • how is that a duplicate of that other question? two different questions. It takes me to ERROR 404 page for whatever reason – BragDeal Jul 25 '15 at 23:29
  • It's a duplicate as long as you can't showcase any debugging effort. "Not working" is not a sufficient problem description to diagnose something. Guess-the-problem type of questions aren't useful to anyone else. Edit your RewriteLog in, and it shall be reopened. – mario Jul 25 '15 at 23:32
  • I don't have Virtual Service Hosting so I read that RewriteLog wouldn't work. How can I debug and see the error? It's so weird how everything works totally fine on localhost and messed up on godaddy – BragDeal Jul 25 '15 at 23:37
  • Most common pitfalls: [Tips for debugging .htaccess rewrite rules](http://stackoverflow.com/q/9153262), [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/a/31280108), [.htaccess not working apache](http://stackoverflow.com/q/12202387), RewriteBase, AllowOverride, AccessFileName, etc. Else contact server support - after all that's what you're paying exta for. – mario Jul 25 '15 at 23:43
  • I just get Internal Server Error 500, I tried to figure out how to do the debugging but I cannot get it to work or I am doing it wrong. – BragDeal Jul 26 '15 at 20:08

0 Answers0