2015-06-19 25 views
0

我通过在htaccess文件下面的代码重写我的投资组合网站网址,我需要什么样的htaccess规则来容纳文件夹中的文件?

RewriteEngine On 
RewriteBase/

#remove enter code here.php; use THE_REQUEST to prevent infinite loops 
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP 
RewriteRule (.*)\.php$ $1 [R=301] 

# remove index 
RewriteRule (.*)/index$ $1/ [R=301] 

# remove slash if not directory 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} /$ 
RewriteRule (.*)/ $1 [R=301] 

# add .php to access file, but don't redirect 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteCond %{REQUEST_URI} !/$ 
RewriteRule (.*) $1\.php [L] 

的所有作品,直到我想从 的博客-post.php中页面导航到另一个页面,例如,让我说我想去的网页成为cgarcia.design/web/about关于页面,它应该是cgarcia.design/about所以页面可以正常加载。 现在我需要在htaccess文件中更改以适应文件夹内的文件?

我的导航结构如下

  • 工作
  • 简历
  • 博客 - 帖子的文件夹 - 进入
  • 接触

感谢您的任何建议。

回答

0

它添加到您的定义文件:

RewriteRule ^$ web/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ web/$1 
相关问题