- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- apache + redhat + mod_rewrite
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2007 03:57 AM
тАО07-05-2007 03:57 AM
There is something wrong with my apache:
LoadModule rewrite_module modules/mod_rewrite.so
And in vhost.conf :
DocumentRoot /home/default/mysite.com/user/htdocs
My .htaccess looks like that:
eader append P3P "CP=\"PHY DEM ONL STA NAV COM OUR CURi ADM DEV TAI CAO COR BUS DSP\""
RewriteEngine On
rewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html?)\ HTTP/
rewriteRule ^index\.(php|html?)$ http://loansloansloansuk.com/ [R=301,L]
#
rewriteCond %{HTTP_HOST} ^www.mysite.com\.com
rewriteRule (.*) http://mysite.com/$1 [R=301.L]
ErrorDocument 400 http://mysite.com
ErrorDocument 401 http://mysite.com
ErrorDocument 403 http://mysite.com
ErrorDocument 404 http://mysite.com
ErrorDocument 500 http://mysite.com
And rewriting is not working:
Can anyone help ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2007 07:17 PM
тАО07-05-2007 07:17 PM
Solution# turn on the mod_rewrite engine and set the log
# if you want to debug, the log level should be set higher (I use '9')
RewriteEngine On
RewriteLogLevel 0
RewriteLog /var/log/rewrite.log
# rewrite entry for TRACE methods
# TRACE methods can be leveraged to create a vulnerability and do not
# serve any real purpose...disabling them is a good idea
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
# rewrite to mydomain..com, regardless of incoming domain
# I host several aliases on the same domain, but want the URL to always
# read the 'real' domain name. This section takes care of that.
RewriteCond %{HTTP_HOST} !^www\.mydomain.\.com [NC]
RewriteCond %{HTTP_HOST} !^webmail\.mydomain\.com [NC]
RewriteRule ^/(.*) https://www.mydomain..com/$1 [L,R]
# This entry ensures I never have a blank filename
# It's a particular requirement due to how I've built my content management system.
RewriteCond %{SCRIPT_FILENAME} ^/$
RewriteCond %{HTTP_HOST} !^webmail\.mydomain\.com [NC]
RewriteRule ^/$ https://www.mydomain.com/index.php [L,R]
# rewrite for category pages
# This matches any URL like https://www.mydomain.com/catalog/a_category_name
# and rewrites it to https://www.mydomain.com/cat_list.php?cid=
# /etc/httpd/conf/rewrite.mydomain.txt is a text file used as a conversion map
RewriteMap catlist txt:/etc/httpd/conf/rewrite.mydomain.txt
RewriteRule ^/catalog/(.+)\.html /${catlist:$1} [NC]
# These entries used for disabling the site
# First IP entry is office T1, second is home
# These entries stay commented until I have to take the site down for some kind of extended
# maintenance. The two IP conditions allow me to see the normal site from 2 specific locations.
# RewriteCond %{SCRIPT_FILENAME} ^/(.+)\.php [NC]
# RewriteCond %{SCRIPT_FILENAME} !^/maintenance.php [NC]
# RewriteCond %{REMOTE_ADDR} !^11\.22\.33\.44
# RewriteCond %{REMOTE_ADDR} !^55\.66\.77\.88
# RewriteRule ^/(.*) https://www.mydomain.com/maintenance.php [L,R]
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-05-2007 08:27 PM
тАО07-05-2007 08:27 PM
Re: apache + redhat + mod_rewrite
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 04:40 AM
тАО08-29-2007 04:40 AM
Re: apache + redhat + mod_rewrite
I have small problem with rewrite again:
Everythink worksfine but when I'm starting apache I get this error:
cannot use a full URL in a 401 ErrorDocument directive --- ignoring!
Whats up ?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 04:43 AM
тАО08-29-2007 04:43 AM
Re: apache + redhat + mod_rewrite
Header append P3P "CP=\"PHY DEM ONL STA NAV COM OUR CURi ADM DEV TAI CAO COR BUS DSP\""
RewriteEngine On
rewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html?)\ HTTP/
rewriteRule ^index\.(php|html?)$ http://ttt.com/ [R=301,L]
#
rewriteCond %{HTTP_HOST} ^www.ttt.com\.com
rewriteRule (.*) http://ttt.com/$1 [R=301.L]
ErrorDocument 400 http://ttt.com
ErrorDocument 401 http://ttt.com
ErrorDocument 403 http://ttt.com
ErrorDocument 404 http://ttt.com
ErrorDocument 500 http://ttt.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2007 07:30 AM
тАО08-29-2007 07:30 AM
Re: apache + redhat + mod_rewrite
cannot use a full URL in a 401 ErrorDocument directive --- ignoring!
The directive:
ErrorDocument 401 http://mysite.com
Is not correct, does not like a full URL. You should try something like:
ErrorDocument 401 /subscription_info.html