Jump to content

Recommended Posts

i'm trying to get a clean url for my about page.

 

i want to change

 

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

 

to

 

http://www.example.com/about

 

i put my htaccess file as this

 

RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([0-9]+)/?$ about.php

 

it's not working though, i get the 404 not found error.

Link to comment
https://forums.phpfreaks.com/topic/241180-php-mod_rewrite-help/
Share on other sites

It sounds to me like there might be some confusion in this thread. If a request to example.com/about.php returns the file, then it sounds to me like public_html/example.com is the document root, not public_html as would be the standard (generally speaking i'd set that up as example.com/public_html). If this indeed the case and you are putting the .htaccess file outside the document root then it is not evening being parsed. One way to checkout would be to place the following in the .htaccess file...

 

RewriteEngine On
RewriteRule .* http://www.google.com [R=302,L]

 

... if you can request a page on your site without getting sent to google, the file isn't being parsed.

 

It seems to me, assuming I'm understanding your description correctly, that the .htaccess file should be in folder public_html/example.com/ along with your about.php file (this is essentially what wildteen88 said, just thought I'd clarify the reason).

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.