LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-29-2010, 07:47 PM   #1
vikram_cvk
Member
 
Registered: Jan 2004
Location: Hyderabad , India
Distribution: RHL 9
Posts: 42

Rep: Reputation: 15
URL Rewriting not working, .htaccess file in a subdirectory.


Hello Experts,

Trying to learn url rewriting,

I have created simple rewrite rules in a subdirectory .. but i guess they are not working (i tried saving.htaccess in root directory still no change)

Kindly access the following http://www.jipindia.org/urlrewrites/samplefile.html

Here i have given 2 dummy file links, when somebody clicks on 'Old File' .. i want url redirection to happen and
instead of http://www.jipindia.org/urlrewrites/old.html shown in the address bar i want

http://www.jipindia.org/urlrewrites/new.html to be shown in address bar.

Similarly when somebody clicks on 'Category File' .. i want url redirection to happen and
instead of http://www.jipindia.org/urlrewrites/details-priority-33-cat_id-44-type-22.html shown in the address bar

I want http://www.jipindia.org/urlrewrites/priority33/hometheater44/widescreen22 to be displayed

To achieve the above i have created following .htaccess file in 'urlrewrites' subdirectory




Options +FollowSymLinks
RewriteEngine on
RewriteRule ^urlrewrites/old\.html$ urlrewrites/new.html
RewriteRule details-priority-(.*)-cat_id-(.*)-type-(.*)\.html$ priority$1/hometheater$2/widescreen$3





Please help me, thanks in advance.

Last edited by vikram_cvk; 12-29-2010 at 07:49 PM.
 
Old 12-29-2010, 08:53 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by vikram_cvk View Post
RewriteRule ^urlrewrites/old\.html$ urlrewrites/new.html
RewriteRule details-priority-(.*)-cat_id-(.*)-type-(.*)\.html$ priority$1/hometheater$2/widescreen$3
Since you're anchoring the first regex (with ^), I believe you need to include the slashes, like this:
Code:
RewriteRule ^/urlrewrites/old\.html$ /urlrewrites/new.html

The second example seems to be working correctly, because I receive the following 404 message. That is, the error wasn't that it didn't translate it, but that it couldn't find the file to serve. Maybe you need a trailing slash after widescreen$3.
Code:
The requested URL /urlrewrites/priority33/hometheater44/widescreen22 was not found on this server.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
URL Rewriting in htaccess hatchnet Linux - General 7 07-05-2010 05:57 PM
Debian Apache2 rewriting subdirectory to root breaks accessing cgi scripts sweetie_lolz3 Linux - Server 1 05-25-2010 04:02 PM
Squid - URL Rewriting nitrohuffer2001 Linux - Enterprise 1 10-23-2008 07:44 PM
URL Rewriting mrpraveen.p Linux - Newbie 1 06-03-2008 07:07 AM
URL Rewriting getmeontop Linux - Newbie 1 04-02-2008 02:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration