douan4359 2017-03-05 17:18
浏览 30
已采纳

Htaccess URL重写[GET不起作用]

In my site I use "show.php?cat=1" type URLs. I want to change for SEO optimization this link types.

I have tried before but I can't understand how to do that.

# Root Host
-- Project Folder
--- index.php
--- show.php
--- css/js/ and other folders

My first purpose is change my links

show.php?cat=1 to show/1/

my code is

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^/show/(.*)$ show.php?cat=$1 [QSA,L]

But it doesn't work. I have a GET error. What's wrong?

And my css files gone to /show/css URL

I'am very angry, my css files gone but Get function doesn't work.

Thanks for help.

Edit: If I change show code to 'test' like that, page becomes 404. Why? Note: I'am using WAMP Server 3, Apache Rewrite_module is working.

RewriteRule ^/test/(.*)$ show.php?cat=$1 [QSA,L]

"The requested URL /project1/test/1 was not found on this server."

  • 写回答

1条回答 默认 最新

  • douan5151 2017-03-05 18:08
    关注

    Use:

    Options +FollowSymLinks -MultiViews
    RewriteEngine on
    
    RewriteRule ^show/(.*)$ show.php?cat=$1 [QSA,L]
    

    Without first / in htaccess RewriteRule pattern

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试