English 中文(简体)
查阅规则的问题
原标题:issues with regex for .htaccess rules

我在访问我的网站上有这样的内容:

Rewrite Rule ^([0-9]+)$ profilescorta.php?t=$1 [L]

因此,如果用户正在使用诸如http:// url/1231231234等链接,该网页就正确展示。

Now, if someone tries to access a link like: http:// url/123.123.1234 - the 404 error page is showed.

I have added this rule to .htaccess RewriteRule ^([0-9]+).(.*) $1$2 [N]

If someone is accesing: http:// url/123.123.1234 - the page is correctly displayed but now the problem is that the same page has 2 different links: http:// url/123.123.1234 and http:// url/1231231234

在有人访问后转至?

Thanks, Bogdan

问题回答

新的解决办法:

#Better 1 redirect /123.123.1234 -> /1231231234
#Assume phone number in this format: [3 Digits] Dot [3 Digits] Dot [4 Digits]
RewriteRule ^([0-9]{3}).([0-9]{3}).([0-9]{4})$ /$1$2$3 [R=301]

旧的解决办法:

[Bad] Double redirect /123.123.1234 -> /123123.1234 -> /1231231234
RewriteRule ^([0-9]+).(.*) /$1$2 [R]




相关问题
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:...

热门标签