Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need quick apache help
#1
For some reason, I forgot how to do this with mod_rewrite.

Okay. I have a bunch of files like this:

http://www.example.com/200.php
http://www.example.com/300.php
http://www.example.com/400.php

So on and so forth. But, I only want people to type in:

http://www.example.com/200

and it will redirect them to:

http://www.example.com/200.php

I cannot use Redirect 301's, I can only use mod_rewrite

Any help?
Reply
#2
copy pasteahhhhh

Quote:RewriteEngine On
RewriteCond %{REQUEST_URI} !^(.*)\.(.*)$
RewriteRule ^(.*)$ %{REQUEST_URI}.php [R]
Reply
#3
Thanks X->L, but now I just realized my webhost isn't processing my .htaccess file. O_o

I put "deny from all" line and didn't get a 403 error.
Reply
#4
Wouldn't it be easier to do it with mod_alias than mod_rewrite? That's how I'd think of doing something like this. I've never done something like this since my server is just for private use. I'll test a bit, give me a second.
Reply
#5
Check your error-log. If no reference to .htaccess is around, check AllowOverride, even though you've probably already checked that.
Reply
#6
Shared hosting, so there's no error log to check. After looking around, it seems that it takes several hours for .htaccess to get enabled on my host (previously disabled). Thanks for the help, guys. I'll just wait for it to get enabled.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)