Forum Moderators: phranque
RewriteEngine on
Options +SymLinksIfOwnerMatch
#obligation to use https
SSLOptions +StrictRequire
SSLRequireSSL
ErrorDocument 403 /err_redirect.php
AuthName "public"
AuthUserFile "/home/domaine/.htpasswds/public_html/passwd"
AuthType Basic
require valid-user
<Files /err_redirect.php>
AuthType none
</Files>
RewriteCond %{HTTP_HOST} ^www\.domaine\.info$
RewriteRule ^(index\.php*)?$ /forum/SMF1113/index.php [L]
# External Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ ^/old-path\ HTTP/
RewriteRule ^old-path http://www.example.com/new-path [R=301,L] # Internal Rewrite
RewriteRule ^new-path /old-path [L]
https://www.example.info/forum/SMF1113/index.php?action=profile ==> [example.info...] Your proposed "new" URLs are far from optimum. You risk Duplicate Content fromandwww.example.info/index.php?action=profilefor example.www.example.info/?action=profile
There is no need to expose thetechnology in the URLs. Likewise the.phppart is not required.action=
I would usehere, and rewrite external requests forwww.example.info/profileto internally fetch content from/profile./index.php?action=profile
URLs are a reference system used on the web. You can make your URLs whatever you want. They in no way have to reflect the internal structure of your server.
/old-file.html, normal server operation would allow you to access it by requesting www.example.com/old-file.html. www.example.com/new-reference pulls content from the /old-file.html server path without revealing that is where it is coming from. /old-file.html location, you add a Redirect. With that external redirect in place, a request for www.example.com/old-file.html triggers the server to respond not with content but with a 301 external redirect telling the browser to make a new request for the new URL at www.example.com/new-reference instead.
RewriteEngine on
# External Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ ^/forum/SMF1113\ HTTP/
RewriteRule ^forum/SMF1113 https://www.domaine.info/ [R=301,L]
# Internal Rewrite
RewriteRule ^ /forum/SMF1113 [L]
RewriteEngine on
# External Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /forum/SMF1113\ HTTP/
RewriteRule ^forum/SMF1113 [domaine.info...] [R=301,L]
#tested with https and https
# Internal Rewrite
RewriteCond %{REQUEST_URI} !^/(forum|robots\.txt)
RewriteRule (.*) /forum/SMF1113/$1 [L]
external rewritingThere's "external redirecting" and "internal rewriting". Don't confuse the two. Both use a RewriteRule.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /forum/SMF1113/(index\.php[^\ ]*)?\ HTTP/
RewriteRule ^forum/SMF1113 https://www.domaine.info/ [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /forum/SMF1113[^\ ]*\ HTTP/
RewriteRule ^forum/SMF1113/(.*) https://www.domaine.info/$1 [R=301,L]