簡體   English   中英

如何獲取htaccess文件以允許變量使用句點?

[英]How can I get my htaccess file to allow periods for a variable?

當我轉到whats-next/wn_controller.php?user=john.smith ,它可以工作。 但是當我轉到whats-next/john.smith ,它不起作用。

我嘗試過這一行:

RewriteRule ^whats-next/([A-Za-z0-9-_]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

對此:

RewriteRule ^whats-next/([A-Za-z0-9-\._]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

和這個:

RewriteRule ^whats-next/([A-Za-z0-9-._]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

但這還沒有解決。

這是我的完整.htacess文件在下面列出。

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)$

#RLA Page
RewriteRule ^about/$ whats-next/wn_controller.php [NC,L] # Process about
RewriteRule ^about$ whats-next/wn_controller.php [NC,L] # Process about ##WITHOUT TRAILING DASH URL TOO. FIX SOMEDAY

#What's Next User
RewriteRule ^whats-next/community/$ whats-next/wn_controller.php [NC,L] # Process community
RewriteRule ^whats-next/follow-up/$ whats-next/wn_controller.php [NC,L] # Process follow-up
RewriteRule ^whats-next/people/$ whats-next/wn_controller.php [NC,L] # Process people
RewriteRule ^whats-next/messages/$ whats-next/wn_controller.php [NC,L] # Process messages
RewriteRule ^whats-next/messages([A-Za-z0-9-]+)$ whats-next/wn_controller.php?message=$1 [NC,L] # Process messages
RewriteRule ^whats-next/([A-Za-z0-9-_]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles
RewriteRule ^whats-next/settings/$ whats-next/wn_controller.php?user=$1 [NC,L] # Process settings

#What's Next Admin
RewriteRule ^whats-next/admin/$ whats-next/wn_controller.php [NC,L] # Process profiles
RewriteRule ^whats-next/admin$ whats-next/wn_controller.php [NC,L] # Process profiles ##WITHOUT DASH TOO. FIX SOMEDAY

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

嘗試在0-9之后立即刪除破折號。

這對我^whats-next/([A-Za-z0-9._]+)$^whats-next/([A-Za-z0-9._]+)$

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM