文件夹或子文件夹中的 .htaccess 动态 Url
.htaccess Dynamic Url in Folder or Subfolder
我在找什么
在文件夹内创建动态 SEO 友好 URL
like:
exmple.com/category/product/my-heading-1 or 2 or 3
current directory:
exmple.com/category/
exmple.com/category/product/
我尝试使用此代码,但它仅适用于主页。我没有使用 MySQL
RewriteEngine on
RewriteRule ^product/([0-9a-zA-Z]+) product.php?u=&1 [NC,L]
请将您的htaccess 文件保存在category 文件夹中,并按照以下规则尝试一次。请确保在测试您的 URL 之前清除浏览器缓存。
也不确定你为什么提到 product.php 它没有出现在你显示的屏幕截图中,所以在此处的重写规则中提到 index.php。
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^product/([0-9a-zA-Z]+)/?$ index.php?u=&1 [NC,L]
我在找什么
在文件夹内创建动态 SEO 友好 URL
like:
exmple.com/category/product/my-heading-1 or 2 or 3
current directory:
exmple.com/category/
exmple.com/category/product/
我尝试使用此代码,但它仅适用于主页。我没有使用 MySQL
RewriteEngine on
RewriteRule ^product/([0-9a-zA-Z]+) product.php?u=&1 [NC,L]
请将您的htaccess 文件保存在category 文件夹中,并按照以下规则尝试一次。请确保在测试您的 URL 之前清除浏览器缓存。
也不确定你为什么提到 product.php 它没有出现在你显示的屏幕截图中,所以在此处的重写规则中提到 index.php。
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^product/([0-9a-zA-Z]+)/?$ index.php?u=&1 [NC,L]