doukong1391 2017-02-07 09:45
浏览 32

重写URL更改

I need some help with my rewrite modules on my page. I would like to change my URL like i write under:

http://www.3esdesign.com/portfolio/budynki?projekt=koncepcja-hotelu-roznow

i want to my link looks like

http://www.3esdesign.com/portfolio/budynki/koncepcja-hotelu-roznow

Where "koncepcja-hotelu-roznow" will be diffrent to other pages.

This is my actually htaccess code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{HTTP_HOST} ^domena.com(.*) [NC]
RewriteRule ^(.*)$ http://www.domena.com/$1 [R=301,L]

I'm trying this code in main directory

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^portfolio/([\w-]+)/([\w-]+)$ portfolio/$1.php?projekt=$2 [L]
RewriteCond %{HTTP_HOST} ^3esdesign.com(.*) [NC]
RewriteRule ^(.*)$ http://www.3esdesign.com/$1 [R=301,L]

Serwer logs:

[Tue Feb 07 11:25:31.379189 2017] [autoindex:error] [pid 55:tid 139960610965248] [client 82.115.92.43:59639] AH01276: Cannot serve directory /home/parkwnetrz/ftp/3esdesign/portfolio/: No matching DirectoryIndex (index.php,index.php4,index.php3,index.php5,index.cgi,index.pl,index.htm,index.html,index.shtm,index.shtml,index.wml,default.htm,default.html,index_default.html,index_default.php) found, and server-generated directory index forbidden by Options directive
[Tue Feb 07 11:16:50.028891 2017] [proxy_fcgi:error] [pid 27:tid 139960527038208] [client 185.85.239.157:58525] AH01071: Got error 'Primary script unknown
'
[Tue Feb 07 11:13:52.304869 2017] [core:alert] [pid 55:tid 139960594179840] [client 82.115.92.43:59262] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:41.164930 2017] [core:alert] [pid 55:tid 139960602572544] [client 40.77.167.42:17519] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:16.105461 2017] [core:alert] [pid 27:tid 139960476681984] [client 82.115.92.43:59249] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:15.897717 2017] [core:alert] [pid 27:tid 139960485074688] [client 82.115.92.43:59249] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:15.704692 2017] [core:alert] [pid 27:tid 139960527038208] [client 82.115.92.43:59249] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:15.465792 2017] [core:alert] [pid 27:tid 139960535430912] [client 82.115.92.43:59249] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:13:14.926891 2017] [core:alert] [pid 27:tid 139960569001728] [client 82.115.92.43:59249] /home/parkwnetrz/ftp/3esdesign/.htaccess: Invalid command '^portfolio/([\\w-]+)/([\\w-]+)$', perhaps misspelled or defined by a module not included in the server configuration
[Tue Feb 07 11:05:21.923535 2017] [autoindex:error] [pid 55:tid 139960468289280] [client 82.115.92.43:49537] AH01276: Cannot serve directory /home/parkwnetrz/ftp/3esdesign/portfolio/: No matching DirectoryIndex (index.php,index.php4,index.php3,index.php5,index.cgi,index.pl,index.htm,index.html,index.shtm,index.shtml,index.wml,default.htm,default.html,index_default.html,index_default.php) found, and server-generated directory index forbidden by Options directive
  • 写回答

1条回答 默认 最新

  • douruocai4111 2017-02-07 09:55
    关注

    Try it with below conditions seperatly,

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^portfolio/([\w-]+)/([\w-]+)$ portfolio/$1.php?projekt=$2 [L]
    
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?