Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

htaccess URL Rewrite

Posted on 2013-06-06
7
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 75

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 75

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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 7

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 …
Suggested Courses

609 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