Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

htaccess URL Rewrite

I need to make my URL clean so that they look something like

http://www.mysite.com/new/about-us

is equal to

http://www.mysite.com//new/page.php?id=about-us

not really sure how to do this..

thanks
0
bradley525
Asked:
bradley525
  • 4
  • 2
1 Solution
 
käµfm³d 👽Commented:
Put "http://www.mysite.com/new/about-us" in your page(s). Then create a rewrite rule in your.htaccess to do the transformation:

RewriteRule ^new/([^/]+)$ new/page.php?id=$1

Open in new window

0
 
bradley525Author Commented:
I added the htaccess file but I get a 404 error using

http://www.mysite.com/new/about-us
0
 
käµfm³d 👽Commented:
Do you have mod_rewrite enabled, and in which .htaccess file did you place the rule?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Robert SaylorSenior DeveloperCommented:
it has to be enabled in apache. Are you using a control panel? What level of access do you have to your server?
0
 
bradley525Author Commented:
Yes I am useing control panel, the .htaccess file is

RewriteEngine On 
RewriteRule ^new/([^/]+)$ new/page.php?id=$1

Open in new window


it is not doing anything though.
0
 
bradley525Author Commented:
got it working, since I am working in the folder "new" I do not need the "new/" in the code above, i just used


RewriteEngine On 
RewriteRule ^new/([^/]+)$ page.php?id=$1

Open in new window

0
 
bradley525Author Commented:
This works perfect if you are in the root folder, if not just remove the "new/" and it will work...thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now