i have hosted two sites on same server and i mange them giving folders for each domain. i want to site comes as
example.com/example
example1开发者_Python百科.com/example1
i want to come
example.com and example.com
i come to know that htaccess url redirecting can do this but i have less idea about it. if there is some tutorial on php regular expression please let me know. some help is appreciable.
edited i solved this problem by putting .htaccess file in root and writing:
RewriteEngine On
#for example.com
RewriteCond %{HTTP_HOST} example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/example/.*$
RewriteRule ^(.*)$ /example/$1 [L]
when i hit example.com it works fine now. it access the folder /example. but i had a problem on a certain domain. i m using codeigniter and i have to redirect its request also so that it does not show
example.com/example/index.php/controller/
i want to show this:
example.com/controller/
hope some experts can help.
The .htaccess url redirecting is setup as a file in your main directory and your code can look something like this:
# These redirects should do the trick :-)
Redirect example.com/example http://www.example.com
Redirect example.com/example1 http://www.example.com
精彩评论