hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Mod_rewrite redirect help
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Mod_rewrite redirect help

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 08-07-2008, 02:52 PM
Jinovich Jinovich is offline
Newbie
 
Join Date: Jun 2006
Posts: 14

Mod_rewrite redirect help


Basically, I have moved my web application from

/public_html/news/ to /public_html/

I would like to set the redirects so that

/news/index.php?catid=22&newsid=23 would go to /index.php?catid=22&newsid=23

Basically all I want it to do is get the url and remove the /news from it so that all the links to content on my site still works.


Can anyone help as I am failing with the code for this task.

Code:
RewriteRule ^news/([^/\.]+)/?$ /$1 [L]
would this rule work?


Last edited by Jinovich; 08-07-2008 at 02:55 PM.
Reply With Quote


Sponsored Links
  #2  
Old 08-07-2008, 03:24 PM
koolcards koolcards is offline
Junior Guru Wannabe
 
Join Date: Aug 2004
Location: Tampa, Fl
Posts: 51
You can try this:

Code:
RewriteEngine on
RewriteRule   ^/news/$  /  [R]
http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

Personally, I would simply replace the '/news' directory with a static link to '/public_html'

Reply With Quote
  #3  
Old 08-07-2008, 04:33 PM
qbert220 qbert220 is offline
Newbie
 
Join Date: May 2005
Posts: 24
Quote:
Originally Posted by Jinovich View Post
Code:
RewriteRule ^news/([^/\.]+)/?$ /$1 [L]
would this rule work?
The "\." will match a dot in the "index.php" part of the URL. The match then fails.

I think

Code:
RewriteRule ^news/(.*)$ /$1 [L]
should work for you.

__________________
DNS Test Report

Reply With Quote
Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
Web Host WebHostForASP.net Launches VPS Hosting Service Web Hosting News 2012-06-29 14:52:22
Google to Build $300 Million, 300K-Square-Foot Hong Kong Data Center Web Hosting News 2011-12-09 15:58:44
Officials Arrest Six Estonians in DNSChanger Cybercrime Bust Web Hosting News 2011-11-10 21:52:48
FBI Scrubs 19,000 PCs Infected by Coreflood Bot Malware Web Hosting News 2011-06-23 15:32:40
Security Firm Symantec Report Finds Spammers Using Fake URL-Shorteners Web Hosting News 2011-05-30 15:41:52


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?