English 中文(简体)
mod rewriter.ht access 表达式删除索引.php 和一个特定的子目录
原标题:mod rewrite .htaccess expressionengine remove index.php and a specific subdirectory

不想问这个问题, 但我在桌子上敲了一会儿头, 似乎无法理解。 我使用表达引擎, 使用 mod_ rewret 将索引.php 从我所有的 URL 中移除。 这很好。 此外, 我想要将任何有 Myurl.com/adwords/ ( anything) 的东西重写为 Myurl.com/ ( anything) 。 我的regex 和 htaccess 技巧都比较弱。 以下是我在. htaccess 中拥有的 :

Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/adwords/(.*)$
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

所以,我想我所说的任何事情, 结束于/adwords/( something), 捕捉到的东西, 然后在索引.php 的结尾处 以一美元 附加。 我猜这很简单。 谢谢!

最佳回答

你所寻找的规则 可能只是

RewriteRule ^adwords/(.*)$ index.php/$1 [L]

不需要重写条件,但我想知道... 你真的要重写 < a href="http://myurl.com/adwords/foo" rel="no follow" >http://myurl.com/adwords/foo to ,而不是?

如果您还想重写类似“http://myurl.com/baa/adwords/foo” rel=“nofollow” >http://myurl.com/baa/adwords/foo http://myurl.com/baa/index.php/foo' rel=“nofolp”>http://myurl.com/baa/index.php/foo ,您必须省略:

RewriteRule adwords/(.*)$ index.php/$1 [L]

BTW, 您可以在这里测试您大多数的重写规则 : < a href="http:// htaccess. madewitelove.be/" rel=" no follow" >http:// htaccess. madewitelove.be/

问题回答

暂无回答




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

热门标签