Jump to content

Editing .htaccess File For Pretty Urls In My Website


Recommended Posts

Posted

Hi,

How can i implement pretty urls for my website build in php by accessing .htaccess files?. something like.......

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^users/(\d+)*$ ./profile.php?id=$1
RewriteRule ^threads/(\d+)*$ ./thread.php?id=$1

RewriteRule ^search/(.*)$ ./search.php?query=$1

Posted

Hi,

It is working with errors. When i go to users/myname the page profile.php?id=myname is coming but the images in the page are broken. When i checked the URL of the images it is showing like domain.com/users/image.jpg. But i saved my images in the home directory it is supposed to be like domain.com/image.jpg. But here it showing as image.jpg is in the directory of users. Please help me to solve this issue.

Posted

What CMS is that?

how about changing the image links from images/myimage.png to /image/myimage.png so it's not a relative link to the current link but to top dir instead?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...