htaccess隐藏子域名url参数

时间:2015-10-18 23:45:06

标签: php regex apache .htaccess

这是我的网址现在显示;

http://blog.example.co.uk/post?id=152&title=titleofpost

这是我的htaccess,如下所示;

将/dir/foo.php外部重定向到/ dir / foo

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

要将/ dir / foo内部重定向到/dir/foo.php

RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]

博客子域

RewriteCond %{HTTP_HOST} blog.example.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteRule ^(.*)$ /blog/$1 [L]

如何将网址显示为;

http://blog.example.co.uk/post/titleofpost

http://blog.example.co.uk/titleofpost

由于

0 个答案:

没有答案