Solved

rewrite same url using slash AND no slash

Posted on 2011-02-14
3
448 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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). #…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

776 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