序文
プロファイルページのURLを書き直そうとしています。私のすべてのアプリケーションページには.html
拡張子が付いているので、文字、数字、、、-
およびだけを一致させようとしてい.
ます。
したがって、これらは有効です
site.com/steve
site.com/steve-robbins
site.com/steve.robbins
しかし、これらはそうではありません
site.com/steve.html
site.com/steve-robbins.php
.html
カスタムURLに、または.php
最後にないようにチェックを入れていると仮定します。
問題
私は現在これを使用していますが、機能していません
RewriteRule ^([a-zA-Z0-9\.-]+)$ profile.php?url=$1 [L]
url
に設定する必要steve
がありますが、に設定していますprofile.php
私は何が間違っているのですか?
私の完全な.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
#
# LOGIN
#
RewriteRule ^([a-z0-9]{255})/activate\.html$ login.php?activate=$1 [L]
RewriteRule ^logout\.html$ login.php?logout [L]
#
# SETTINGS
#
RewriteRule ^change-([a-z]+)\.html$ account-settings.php?$1 [L]
RewriteRule ^([a-zA-Z0-9\.-]+)$ profile.php?url=$1 [L]
# SEO friendly URLs
RewriteRule ^([a-zA-Z0-9-_.]+)\.html$ $1.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([a-zA-Z0-9-_.]+)\.php
RewriteRule ^([a-zA-Z0-9-_.]+)\.php$ $1.html [R=301]