开发者

mod rewrite - clarification

开发者 https://www.devze.com 2023-02-27 13:43 出处:网络
My htaccess code is RewriteEngine on Options +FollowSymlinks -MultiViews # URL REWRITE RewriteRule ^domain-name/?$ domain.php [L]

My htaccess code is

RewriteEngine on
Options +FollowSymlinks -MultiViews

# URL REWRITE
RewriteRule ^domain-name/?$ domain.php [L]
RewriteRule ^domain-name/registration/?$ domain-registration.php [L]
RewriteRule ^dom开发者_运维技巧ain-name/price/?$ domain-price.php [L]
RewriteRule ^domain-name/security/?$ domain-security.php [L]
RewriteRule ^domain-name/features/?$ domain-features.php [L]
RewriteRule ^domain-name/faq/?$ domain-faq.php [L]
RewriteRule ^domain-name/provider/?$ domain-why-choose-us.php [L]
RewriteRule ^domain-name/free/?$ domain-free.php [L]
RewriteRule ^domain-name/transfer/?$ domain-transfer.php [L]

# 301
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

My question is, If i enter http://domain.com/domain-name/free this is working fine. But

http://www.domain.com/domain-name/free is goes to my original php file (free.php)

How to solve this?


Problem Solved My correct code is bellow

RewriteEngine on
Options +FollowSymlinks -MultiViews

# 301
RewriteCond %{HTTP_HOST} ^www\.globaliway\.com$ [NC]
RewriteRule ^(.*)$ http://globaliway.com/$1 [R=301,L]

# URL REWRITE
RewriteRule ^domain-name/?$ domain.php [L]
RewriteRule ^domain-name/registration/?$ domain-registration.php [L]
RewriteRule ^domain-name/price/?$ domain-price.php [L]


I have modified your .htaccess file to fix few things, please copy/paste from here INCLUDING the option line Options +FollowSymlinks -MultiViews

RewriteEngine on
Options +FollowSymlinks -MultiViews

# URL REWRITE
RewriteEngine  on
RewriteRule ^domain-name/?$ /domain.php [L,NC]
RewriteRule ^domain-name/registration/?$ /domain-registration.php [L,NC]
RewriteRule ^domain-name/price/?$ /domain-price.php [L,NC]
RewriteRule ^domain-name/security/?$ /domain-security.php [L,NC]

# 301
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
0

精彩评论

暂无评论...
验证码 换一张
取 消