2 problems with mod_rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

2 problems with mod_rewrite

Postby Svejk » Tue Dec 16, 2008 3:33 am

Hi,
I have 2 problems with mod_rewrite:
1. I need to substitute "//" with "/" at the end of the address.

2. I want to forbid going to file "index.php". This file exists, but users can't go to this file.

Can anybody help me?
Thanks.
Svejk
 
Posts: 1
Joined: Thu Dec 11, 2008 4:55 am

Postby richardk » Tue Dec 16, 2008 6:55 am

Do you have any mod_rewrite at the moment?
How many // will there be (eg. /abc//def/ only or infinite //abc//def//ghi//)?
Only /index.php or all index.php files?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^index\.php$ - [F,L]

RewriteCond %{THE_REQUEST} \ /*(/.+)//+([^\ ]*)\  [NC]
RewriteRule .* %1/%2 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 2 guests

cron