Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

rewrite same url using slash AND no slash

Posted on 2011-02-14
3
Medium Priority
?
454 Views
Last Modified: 2012-05-11
Hi,

My client wants to be certain that if a site visitor types in a url with OR w/o a trailing slash i.e.

mysite.com/artists/warhol
OR
mysite.com/artists/warhol/

the same page will load.

currently my htaccess file has these rules-i can use one or the other, but not both -I NEED FOR BOTH TO WORK

RewriteRule ^/artists/(.+)$ /artists/artist.cfm?permalink=$1 [QSA]
RewriteRule ^/artists/(.+?)/ /artists/artist.cfm?permalink=$1 [QSA]
0
Comment
Question by:phillystyle123
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 2000 total points
ID: 34893052
Try using just this one rule:

RewriteRule ^/artists/(.+?)/?$ /artists/artist.cfm?permalink=$1 [QSA] 

Open in new window


The ? after the / (  /?$ ) should make it optional.
0
 

Author Closing Comment

by:phillystyle123
ID: 34893259
perfect  - thanks!
0
 

Author Comment

by:phillystyle123
ID: 34899094
I posted a continuation of this question here:

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_26823130.html

because I'm having trouble getting the next url in my sequence to pull content from my database
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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

971 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