2013-07-26 35 views
0

發現我有URL http://www.mydomain.com/firstdir/seconddir/file.php或URL http://www.mydomain.com/firstdir/file.php和其他一些人。在現有的.htaccess文件的.htaccess重定向如果圖案URL

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] 

我想有任何URL頁面XY重定向,如果模式firstdir是在URL路徑。

每當我試圖建立在任何rewriteCond,整個網站被重定向... Thanky的任何幫助。

回答

0

使用下面提到的代碼。

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

所以,完整的代碼將是:

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] 
+0

非常感謝您Debashis。我會試試看。 – urs63