| | #1 |
| HyperActive Warrior War Room Member Join Date: 2006 Location: , , .
Posts: 342
Thanks: 22
Thanked 11 Times in 10 Posts
|
How do I solve the following. ? Code: www.example.com/tires www.example.com/tires/slicks When I click on the slicks page on a breadcrumb to "tires" it shows example.com/tires/ instead of .com/tires and then the links on the page become messed up. How do I make it work all the way around? I have seen it working flawlessly on a few other sites here is my current htaccess Code: <Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
Options +FollowSymLinks
ErrorDocument 404 /404/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.htm HTTP/
RewriteRule ^index.htm$ http://www.example.com/ [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/
RewriteRule ^index.htm$ http://example.com/ [R=301,L]
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://www.example.com/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+).php([#?][^ ]*)? HTTP/
RewriteRule ^(.+).php$ http://www.example.com/$1 [R=301,L]
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L] |
| |
| | #2 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Hi, I am a bit confused by your examples, and by the redundancy in your htaccess. What I understand you want to achieve is the following: Code: http://www.example.com/tires -> www.example.com/tires/index.html http://www.example.com/tires/slicks -> www.example.com/tires/slicks.html as an improvement you can add this line Code: RewriteEngine on RewriteBase / You could get rid of all the domain names in the rules/coditions expect you really want to redirect to a different server. If you leave the R=301 in the flags of the rewrite rules the user will see the url change in his browser, as the browser will be notified that the resource has changed the location. If you want to make it silent (invisible to the user) remove all the R=... flags from the Rules. Hope that helps Mike |
| |
| | #3 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Hi, I am a bit confused by your examples, and by the redundancy in your htaccess. What I understand you want to achieve is the following: Code: http://www.example.com/tires -> www.example.com/tires/index.html http://www.example.com/tires/slicks -> www.example.com/tires/slicks.html as an improvement you can add this line Code: RewriteEngine on RewriteBase / You could get rid of all the domain names in the rules expect you really want to redirect to a different server. If you leave the R=301 in the flags of the rewrite rules the user will see the url change in his browser, as the browser will be notified that the resource has changed the location. If you want to make it silent (invisible to the user) remove all the R=... flags from the Rules. Hope that helps Mike |
| |
| | #4 | |
| HyperActive Warrior War Room Member Join Date: 2006 Location: , , .
Posts: 342
Thanks: 22
Thanked 11 Times in 10 Posts
|
Code: www.example.com/tires www.example.com/tires/slicks what doe snot work now is when you are on this page -- > www.example.com/tires/slicks and click the link to go back to www.example.com/tires , it takes you to www.example.com/tires/ when it should be just www.example.com/tires a separate page the site is in php, not .html | |
| |
| | #5 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Can you turn on the rewrite log. By adding these lines Code: RewriteLog "PATH_TO_LOG_LOCATION/rewrite.log" RewriteLogLevel 3 Mike |
| |
|
| Bookmarks |
| Tags |
| extension, folder, htaccess, page, remove |
| |