Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 04-02-2011, 01:24 PM
DarkBabylon DarkBabylon is offline
Hatchling Croc
 
Join Date: Apr 2011
Posts: 1
Unhappy Mod_rewrite QUERY_STRING to directory?

So I have a simple mod_rewrite problem:

I want this:
mydomain.com/index.php?p=article&id=24sfhjs2378dhs

to be:
mydomain.com/article/24sfhjs2378dhs


Currently I'm using:
Code:
# General Stuff
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

#Domain removal of www.
RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?thebabylontimes\.com)$ [NC]  
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

#Redirection (which is working btw) for a couple pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home /index.php?p=home [L]
RewriteRule ^music /index.php?p=music [L]
RewriteRule ^tech /index.php?p=tech [L]

Thanks so much, this is very urgent.
Cheers,
--
Nick.
Reply With Quote
  #2  
Old 05-18-2011, 10:51 PM
GatorJim's Avatar
GatorJim GatorJim is offline
HostGator Staff
 
Join Date: Apr 2007
Posts: 80
Default Re: Mod_rewrite QUERY_STRING to directory?

Try something like this. I haven't tested it though.

RewriteRule ^([a-zA-Z_]+)(/([0-9a-zA-Z_]+)/?$ index.php?p=$1&id=$3 [QSA,L]
Reply With Quote
Reply

Bookmarks

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod_Rewrite GOODY Off-Topic 12 05-12-2008 08:35 PM
mod_rewrite Clearlime Shared Hosting Support 0 03-02-2007 01:27 PM
Moving a site from my main directory to a sub-directory - HOW? Mikey Shared Hosting Support 1 09-21-2006 08:50 AM
mod_rewrite deepsignal Pre-Sales Questions 4 07-19-2005 12:34 PM
mod_rewrite Unregistered Pre-Sales Questions 1 03-22-2005 01:38 PM

All times are GMT -5. The time now is 03:35 PM.