所以我使用来自互联网的脚本,我得到以下 URL:
http://mydomain.net/pages/92/Marketing-Idea
我希望它看起来如下:
http://mydomain.net/marketing-idea
我对 URL 重写不熟悉,所以在查找了一些教程后,我厌倦了以下规则/条件,但它根本不起作用:
RewriteRule ^/([A-Za-z0-9-]+)/?$ /pages/$1/$2 [NC,L] # pages
有什么可以帮助我的吗?我在这里很绝望,不能让这个垃圾工作!
这是整个 .htaccess 文件:
#SetEnv APPLICATION_ENV development
Options -Indexes
Options +FollowSymLinks
DirectoryIndex index.php index.html
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php [L,QSA]
RewriteRule ^([0-9]+)/([a-z0-9-]+)/?$ /pages/$1/$2 [NC,L]
</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>
<ifModule mod_deflate.c>
<filesmatch "\.(js|css|html|jpg|png|gif|eot|woff|ttf|svg)$">
SetOutputFilter DEFLATE
</filesmatch>
</ifModule>
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|cache)$">
Order Allow,Deny
Deny from all
</FilesMatch>
最好的问候, 多里安