2014-02-11 146 views
0

进出口试图找出如何重写URL,以便阿帕奇重写URL git的

mydomain.com/repositories/REPONAME.git 

实际使用那张笨

mydomain.com/repositories/REPONAME/.git 

IM,所以我已经有一些重写规则:

RewriteEngine On 
RewriteBase/
RewriteCond $1 !^(repositories) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php [L,NC] 

回答

0

试试这个代码在你的htaccess文件。

RewriteCond %{REQUEST_URI} ^/repositories [NC] 
RewriteRule ^repositories/(.*)/.git$ /repositories/$1.git [L,NC] 

这将使

mydomain.com/repositories/REPONAME/.git 

被重定向到

mydomain.com/repositories/REPONAME.git 
+0

所以我想我并不完全了解。现在这种作品。它将REPO.git的任何请求重定向到REPO/.git我不希望用户看到重定向,我只希望传递.git。那可能吗? – brandenwagner

+0

我想我误解了你,并做了倒退。请看我的更新答案是否适合你。 –