Solved

About url rewrite

Posted on 2011-03-09
10
280 Views
Last Modified: 2013-12-13
Since it is a Rewrite question not sure I should post it here:

At root level is a dir /nav_excerpts/ it contains excerpts.php
excerpts.php generates a link as follow (here on dev machine) http://localhost/member/profile.php?username=Paul
I am trying to rewrite it so it will read http://localhost/member/profile-Paul.html
Obviously the following is not working

RewriteRule ^member/profile-([a-z0-9]+)\.html$ /member/profile.php?username=$1 [L]
0
Comment
Question by:array007
[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
  • 5
  • 5
10 Comments
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086590
So.. you have this file 'excerpts.php' :
http://localhost//dir/nav_excerpts/excerpts.php

and want it to be accessible through (for example):
http://localhost/member/profile-Paul.html
0
 
LVL 1

Author Comment

by:array007
ID: 35086661
Yes that is correct (you have a little typo, after localhost //)
Thanks
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086807
And where is the HTACCESS file located? Is it in 'dir' directory?

Also, is this link is already accessible :
http://localhost/member/profile.php?username=Paul

And last, in your htaccess file, try to replace [L] with [R] or [R,NC,L] and see if the page redirects you to a correct location.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:array007
ID: 35086885
Thanks that .htaccesss in at root level
I tried the [R,NC,L] but to no avail
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086951
Okay...
(A) http://localhost/member/profile.php?username=Paul
(B) http://localhost/member/profile-Paul.html

If you try to open (A) on your browser, does it show the correct page?

If (A) is not accessible then I think there's no way that (B) will be accessible.
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086970
[R,NC,L]
If you use it on htaccess as I told you, whenever you open (B) check on address bar, it should be redirects you back to (A) .. in other words the URL typed on address bar is changing to (A)
Is it ?
0
 
LVL 1

Author Comment

by:array007
ID: 35087159
A, works fine but the url is not at all rewritten
B, could not be accessed as it is not anywhere in sight
sorry for the headache!
Also before you ask, yes rewrite is on.
0
 
LVL 5

Accepted Solution

by:
onemadeye earned 500 total points
ID: 35087249
Yes I can see that (B) cannot be accessed, but check on the address bar does the URL redirects you back to (A) when you use [R,NC,L]

Try this too :
RewriteRule ^member/profile-([a-z0-9]+)\.html$ member/profile.php?username=$1 [L]

Open in new window

0
 
LVL 1

Author Comment

by:array007
ID: 35087347
Sorry, no the URL does not redirect
as is when overing the link, it still show the GET mode type URL
I will need to perform a live test on my server to see if live makes a difference.
Then I will report back
thanks
0
 
LVL 1

Author Closing Comment

by:array007
ID: 35108381
Thanks, it works on live server
don't know why it's not working on my test bed.
Anyway done!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitting a sting into elements 6 69
How to remove  "0":  in a json string 4 44
How do I allow for non standard CSV file 9 45
Developers / Staff Setup 10 41
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 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