Php 在文件中重写规则
我有一个超过800页的网站,需要整理网址。我需要从这里开始: 为此: 我在.htaccess中成功地实现了这一点:Php 在文件中重写规则,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,我有一个超过800页的网站,需要整理网址。我需要从这里开始: 为此: 我在.htaccess中成功地实现了这一点: RewriteRule ^([a-zA-Z0-9-]+)/plumbing$ /services/plumbing.php?f=$1 [L] 这个问题是,还有数百个这样的页面,我不想每个页面都有一个条目。有没有一种方法可以用reg-ex、通配符或变量来实现 htaccess不是最好的,所以任何帮助都会很好 谢谢你和问候。也许是这样的 RewriteRule ^([a-zA-Z
RewriteRule ^([a-zA-Z0-9-]+)/plumbing$ /services/plumbing.php?f=$1 [L]
这个问题是,还有数百个这样的页面,我不想每个页面都有一个条目。有没有一种方法可以用reg-ex、通配符或变量来实现
htaccess不是最好的,所以任何帮助都会很好
谢谢你和问候。也许是这样的
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ /services/$2.php?f=$1 [L]
因此,如果你去:
http://example.com/franchise/plumbing
http://example.com/something/another-page
它将重写为:/services/pipeoping.php?f=francement
如果你去:
http://example.com/franchise/plumbing
http://example.com/something/another-page
它将重写为:
/services/other page.php?f=something
可能是这样的
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ /services/$2.php?f=$1 [L]
因此,如果你去:
http://example.com/franchise/plumbing
http://example.com/something/another-page
它将重写为:/services/pipeoping.php?f=francement
如果你去:
http://example.com/franchise/plumbing
http://example.com/something/another-page
它将重写为:
/services/other page.php?f=something
是的,这是可能的!你只需要把你的正则表达式推广一点。谢谢你,艾伦。还有很多东西要学!是的,这是可能的!你只需要把你的正则表达式推广一点。谢谢你,艾伦。还有很多东西要学!乔恩-那太完美了,真是一种享受。太谢谢你了。乔恩-那太完美了,真是一次难得的款待。非常感谢你。