更新时间:2023-09-12 08:19:52
尝试在你的根目录的.htaccess这些规则(上述 / M /
A级和 / D /
):
RewriteEngine叙述上
重写规则^ D /(.+)$ / M /#$ 1 [NE,NC,L,R = 302]
重写规则^(。+)$ /#$ 1 [NE,L,R = 302]
确认为删除任何 /d/.htaccess
文件。
如果由于某种原因,你想从 /d/.htaccess
做到这一点,然后使用 /d/.htaccess $此规则C $ C>文件:
RewriteEngine叙述上
重写规则^(。+)$ / M /#$ 1 [NE,NC,L,R = 302]
This is my first post so excuse me if something it's wrong with my way of asking for help. I've been reading other posts related to my problem but none solved it.
My path:
... And so on.
I want to change the /m/pageX to /m/#pageX without hardcoding the URL and without using any additional php scripts.
At the first sight, I've accomplished this task by writing the following .htaccess configuration file:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^[dm]/(.+)$ /m/#$1 [R=302,NE,L,NC]
## hide .php extension
RewriteCond %{THE_REQUEST} \s/+common_([^.]+)\.php[\s?] [NC]
RewriteRule ^ %1 [R=302,L,NE]
## To internally forward
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/common_$1.php -f
RewriteRule ^(.+?)/?$ common_$1.php [L]
Thank you
Try these rules in your root .htaccess (a level above /m/
and /d/
):
RewriteEngine On
RewriteRule ^d/(.+)$ /m/#$1 [NE,NC,L,R=302]
RewriteRule ^(.+)$ /#$1 [NE,L,R=302]
Make sure to remove any /d/.htaccess
file.
If for some reason you want to do it from /d/.htaccess
then use this rule in /d/.htaccess
file:
RewriteEngine On
RewriteRule ^(.+)$ /m/#$1 [NE,NC,L,R=302]