0

我有 URL http://www.mydomain.com/firstdir/seconddir/file.php或 URL http://www.mydomain.com/firstdir/file.php和其他一些。在现有的 .htaccess 文件中

RewriteEngine On
RewriteBase /
RewriteRule ^(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/ - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* /index.php [L]

如果模式firstdir在 URL 路径中,我希望将任何 URL 重定向到页面 XY。

每当我尝试构建任何 rewriteCond 时,整个网站都会被重定向......感谢您的帮助。

4

1 回答 1

0

Use the below mentioned code.

RewriteRule ^firstdir/([^/\.]+)/?$ XY.php [L]

So, the full code will be:

RewriteEngine On
RewriteBase /
RewriteRule ^firstdir/([^/\.]+)/?$ XY.php [L]
RewriteRule ^(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/ - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* /index.php [L]
于 2013-07-26T05:52:25.107 回答