Solved

htaccess URL Rewrite

Posted on 2013-06-06
7
240 Views
Last Modified: 2013-06-16
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
Comment
Question by:bradley525
  • 4
  • 2
7 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39225945
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
 

Author Comment

by:bradley525
ID: 39225972
I added the htaccess file but I get a 404 error using

http://www.mysite.com/new/about-us
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39225984
Do you have mod_rewrite enabled, and in which .htaccess file did you place the rule?
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 6

Expert Comment

by:Robert Saylor
ID: 39232375
it has to be enabled in apache. Are you using a control panel? What level of access do you have to your server?
0
 

Accepted Solution

by:
bradley525 earned 0 total points
ID: 39237381
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
 

Author Comment

by:bradley525
ID: 39237421
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
 

Author Closing Comment

by:bradley525
ID: 39251030
This works perfect if you are in the root folder, if not just remove the "new/" and it will work...thanks
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now