PDA

View Full Version : Page redirects (301?)



heavywater
12-03-11, 14:55
Hey guys,

I'm trying to neaten up some addresses at the moment. The website has a frame (in index.php) and php content inside for separate pages (index.php?id=Roster etc).

I've been playing with the htaccess file and I've got site.com/index.php to redirect to site.com. This means that the roster is now at site.com/?id=Roster.

Is there any way to redirect that to site.com/roster? I'm not sure if it's easy to do with htaccess or whether it should be a 301 redirect at all. :|

Smifis
12-03-11, 14:57
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?id=$1 [L,QSA]



Have fun mate

oh and, dont make index.php redirect to the site root, thats just silly :D

heavywater
12-03-11, 15:11
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?id=$1 [L,QSA]



Have fun mate

oh and, dont make index.php redirect to the site root, thats just silly :D
Hmm, tried that code before, didn't work.


Is it silly to redirect index.php to the root? :(

Smifis
12-03-11, 15:18
yes, because when you visit the root dir, it loads index.php and results in a redirect loop.

That code should work, I'm using it right now :O


where are you sticking it? :lol:

heavywater
12-03-11, 15:27
In the .htaccess file. :confused:

Smifis
12-03-11, 15:39
Apache server?

also, check the there isn't any space at the begining of the file, rename it on the server via ftp too.

heavywater
12-03-11, 15:58
Yup, Apache.

The beginning of the file has some group permissions and some 301 redirects.

Smifis
12-03-11, 16:32
i meant the file name, my bad.

Could you post up your htaccess file?

heavywater
12-03-11, 16:51
Give me a sec, I'll PM you the code. :)

Smifis
12-03-11, 16:54
Okies!

heavywater
12-03-11, 17:46
Lol, wrote that and completely forgot to send it. :D