Jump to content

Urgent : mod_rewrite help for redirecting url as cityname.maindomain.com


Recommended Posts

Hi

 

I am new to mod_rewrite

 

I need two things to do in htacess

 

1. I want all my php pages to display as html

 

  Example : index.php to index.html

        aboutus.php to aboutus.html

 

  I given like this

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule ^([^/]*)\.html$ index.php?action=$1

RewriteRule ^([^/]*)\.html$ aboutus.php?action=$1

 

This works good. But for this a query string is passes. I don’t want to give any query string. If I click index.php it should redirect to index.html. I don’t want to write separate for aboutus.php. within a single code it should redirect all php to html pages

 

 

2. The most wanted thing

 

I want to search a thing using city name in my project

 

For example

 

If I click the cityname eg.chennai

 

The following url will be like this : www.domainname.com/search.php?city=chennai

 

But I want like this

 

http://chennai.domainname.com

 

if I click Mumbai it should be http://mumbai.domainname.com

 

How to do this ?

 

I want like this site

 

http://www.clickindia.com/

http://www.indialist.com

 

There if we click the city name it will redirect the url as cityname.domainname.com

 

Please help

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.