Jump to content

Recommended Posts

ive put this

 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

 

in my .h2access file and upload it to htdocs, but it doesnt seem to do anything.

meaning i can go to this

http://www.languageschoolsuk.com/course_enquiry.php

but not

http://www.languageschoolsuk.com/course_enquiry

 

Am i doing something wrong

Link to comment
https://forums.phpfreaks.com/topic/201756-how-do-i-get-my-htaccess-working/
Share on other sites

It would have helped if you'd defined "doesn't seem to do anything". What do you get on screen a 500 error? A 404 error? My guess is the later of the two, I'd suggest appending the [R=302] flag to the end of the RewriteRule to see if a.) it's actually rewriting at all and if it is b.) where it's rewriting to. My best guess is you need a forward slash before the $1.

  • 5 months later...

I had the same issue for a while on a new server where I was testing out some new things with mod_rewrite that was running apache2... this is how I solved it

 

go into your /etc/apache2 directory

 

then go into your sites-enabled directory and into the site where you're trying to get the site to have the Rewrite Engine working

vi into that file (because hopefully you're doing this at a shell level and not trying to do this from some ISP's control panel editor)  it might be named default if you haven't changed any settings an look in the Virtual host settings

 

#       AllowOverride None
          AllowOverride FileInfo Options

 

You need to set the AllowOverride option from none to FileInfo and options (see my example above where I commented out the none)

 

restart your server (/etc/init.d/apache2 restart on debian/ubuntu  OR service apache2 [httpd] restart on redhat) and your mod_rewrite changes should take place.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.