sabecs
asked on
.htaccess redirect to other page with link info
Hi,
I want to redirect pages that are not found to a redirect_page.php using .htaccess but I want to also process the link information.
For example if I have a link to the following pages that don't exist http://www.mywebsite.com/213 or http://www.mywebsite.com/page=454
how do I pass the '/213' & '/page=454' part to my redirect_page.php page?
ErrorDocument 404 http://www.mywebsite.com/redirect_page.php
I want to redirect pages that are not found to a redirect_page.php using .htaccess but I want to also process the link information.
For example if I have a link to the following pages that don't exist http://www.mywebsite.com/213 or http://www.mywebsite.com/page=454
how do I pass the '/213' & '/page=454' part to my redirect_page.php page?
ErrorDocument 404 http://www.mywebsite.com/redirect_page.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure you have mod_rewrite enabled. Are you using any other rules?
ASKER
Thanks routinet, this is what I have so in my .htaccess.
#SetEnv PHPRC /home/mywebsite/public_html
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_URI} Details
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2&new_page_title=$3 [L]
RewriteRule ([0-9]+)(.*)\.html$ index.php?page_id=$1
RedirectMatch permanent ^/show/?$ http://www.mywebsite.com.au/showme.php
RedirectMatch permanent ^/showme/?$ http://www.mywebsite.com.au/showme.php
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule (.+) /redirect_page.php?uri=$1 [QSA]
I don't see anything obvious there. Try turning on your RewriteLog...perhaps mod_rewrite can provide some feedback about the application of these rules.
Note that you have to turn on the log in your server conf files, not .htaccess.
Note that you have to turn on the log in your server conf files, not .htaccess.
ASKER
Thanks routine, seems to be working now, not sure what I missed...
ASKER