English 中文(简体)
Mod_Rewrite help!
原标题:Mod_Rewrite help!
最佳回答

您对前两项《标准规则》的定期表述也符合你的机动途径,因为<代码>用户/(*)/$只是检验,看看该模式是否与请求中途一致。 请在检测开始之前添加<条码><>><>>>>,以便检查整个请求途径是否与下列内容相符:

RewriteRule ^user/(.*)/$ /viewer/index.php?profile=$1
RewriteRule ^user/(.*)$ viewer/index.php?profile=$1

RewriteRule ^mobile/user/(.*)/$ /mobile/index.php?user=$1
RewriteRule ^mobile/user/(.*)$ mobile/index.php?user=$1

作为旁观,你还可以把沉积的发动机救出一线麻烦,并将你的规则降为两条规则。 我也更新了你的发言内容,因为你可能没有看到他们把前方的分歧列入其中:

RewriteRule ^user/([^/]*)/?$ /viewer/index.php?profile=$1

RewriteRule ^mobile/user/([^/]*)/?$ /mobile/index.php?user=$1
问题回答

您的第一项规则与移动电话规则相匹配,因为它并不局限于/user/,该规则在铺设之初发生。 以<代码>^为序号,以表示起步:

RewriteRule ^user/(.*)/$ /viewer/index.php?profile=$1
RewriteRule ^user/(.*)$ viewer/index.php?profile=$1

RewriteRule ^mobile/user/(.*)/$ /mobile/index.php?user=$1
RewriteRule ^mobile/user/(.*)$ mobile/index.php?user=$1

我不清楚你想要做些什么,但你可以照样压缩你。

Options +FollowSymlinks -MultiViews
RewriteEngine On

RewriteRule ^user/(.*)/?$ /viewer/index.php?profile=$1 [L,NC,QSA]

RewriteRule ^mobile/user/(.*)/?$ /mobile/index.php?user=$1 [L,NC,QSA]




相关问题
Ignore symlinks in clean URL s in .htaccess

Example URL: example.com/user /user is both a symlinked directory and a valid URL to content on my site. I user Horde Routes to request the content and all requests to the site go through index.php. ...

.htaccess File Options -Indexes on Subdirectories

I have the following .htaccess line, simple no indexes on root. Options -Indexes What do we add so it propagates to any sub directory instead of having to create one file for each? One .htaccess on ...

Mod Rewrite ignoring -d

After a day or two, I am still fighting with Mod Rewrite. It seems that 60% of my development time is spent battling the server. My current URL structure is such that all http://example.com/xyz and ...

ErrorDocument 404 Not Sending Referrer Information: PHP

I m using a standard htaccess ErrorDocument 404 to redirect users to a new page. In order to customize the 404, I need to know their referrer information (from the page they Tried to visit). $...

Find all htaccess files on server [closed]

I m looking for a Linux command to go through all the directories on my server and find all .htaccess files. The output would be a list of all those files with full path, creation/modification date ...

301 Redirect Help with Dynamic URL s and Multiple Id s

I just did a redesign for www.wildchildclothes.com which has a new URL structure. The old site ran on Zen Cart and had a bad URL structure. Here are some examples of what I want to redirect from: OLD:...

热门标签