我已经看过每个问题和每个Apache的服务器reWriteRule的例子......没有任何工作。mod_rewrite干净的URL不工作
我只需要改变 http://beta.EXAMPLE.com/profile.php?profile_name=ntgCleaner 到 http://beta.EXAMPLE.com/ntgCleaner
我必须看到,如果my .htaccess file is being read,并查看if mod_rewrite is enabled,他们都完全正常工作。
出于某种原因,我遇到的例子不适合我。以下是一些例子。
RewriteEngine On
RewriteRule /(.*)$ /profile.php?username=$1
,
RewriteEngine On
RewriteBase/
RewriteRule ^profile\/(.*)$ ./profile.php?profileId=$1 [L,NC,QSA]
和
Options +FollowSymlinks
RewriteEngine on
RewriteOptions MaxRedirects=10
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?profile_name=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?profile_name=$1
但所有这些工作。这是因为我使用的是一个子域吗?我计划在完成网站时最终将BETA中的子域名切换到www。
有什么建议吗?
噢,对不起,我只是希望它使用PROFILE_NAME作为清洁网址,所以从example.com/ profile.php?profile_name = ntgCleaner to example.com/ntgCleaner 那些我们只是我想要的例子 – ntgCleaner 2012-08-10 18:28:32
这正是我需要的!我不认为request_filename必须处理任何事情......谢谢! – ntgCleaner 2012-08-10 18:30:56
@ntgCleaner这是一种不会无限循环的方式,因为如果URI指向现有资源(如profile.php),它将不会重新重写。 – 2012-08-10 18:33:46