Forum Moderators: phranque

Message Too Old, No Replies

Forward slash issues

         

Furutsuzeru

5:52 pm on Mar 22, 2009 (gmt 0)

10+ Year Member




RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\ \-]+)$ $1/ [R=301]
RewriteRule ^([a-zA-Z0-9\ \-]+)/$ index.phtml?page=$1 [L]
RewriteRule ^([a-zA-Z0-9\ \-]+)/([a-zA-Z0-9\ \-]+)$ $1/$2/ [R=301]
RewriteRule ^([a-zA-Z0-9\ \-]+)/([a-zA-Z0-9\ \-]+)/$ index.phtml?page=$1&page2=$2 [L]

The RewriteRule sans forward-slashes at the end does not work, and instead, redirects to a home directory path when it should proceed to the rule that has the forward slashes implemented. An example of this not working would be:

[site.com...]

into:

[site.com...]

Any ideas?

[edited by: Furutsuzeru at 5:53 pm (utc) on Mar. 22, 2009]

g1smd

5:57 pm on Mar 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change the order so that all redirects are listed before any of the rewrites.

Make sure that the most specific redirect is listed first in the block of redirects.

Make sure that the most specific rewrite is listed first in the block of rewrites.

The redirects should each include the full domain name in the target URL.

Be aware that a RewriteCond applies only to the single RewriteRule that follows it, so you might need to duplicate those.

Furutsuzeru

7:01 pm on Mar 22, 2009 (gmt 0)

10+ Year Member



Ah, thanks.

I have it fixed.

g1smd

7:06 pm on Mar 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Let's see the final version of the code...