.htaccess - htaccess not redirecting properly with rewrite rules -
i'm trying create simple htaccess file following:
- redirects http://domain.com http://www.domain.com
- allows '.php' extension dropped file names
- allows http://www.domain.com/page/var , http://www.domain.com/page/var/ seen http://www.domain.com/page?u=var
- rewrites http://www.domain.com/page?u=var http://www.domain.com/page/var
this have far, doesn't seem working:
indexignore .htaccess directoryindex index.php options -indexes rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{http_host} !^www\. rewriterule (.*) http://www.%{http_host}%{request_uri} [r=301,l] rewriterule ^([^/.]+)/?$ $1.php rewriterule page1/(.*)/$ /page1?u=$1 rewriterule page1/(.*)$ /page1?u=$1 rewriterule page2/(.*)/$ /page2?t=$1 rewriterule page2/(.*)$ /page2?t=$1 errordocument 400 http://www.domain.com/error?e=400 errordocument 401 http://www.domain.com/error?e=401 errordocument 403 http://www.domain.com/error?e=403 errordocument 404 http://www.domain.com/error?e=404 errordocument 500 http://www.domain.com/error?e=500 addoutputfilterbytype deflate text/plain addoutputfilterbytype deflate text/html addoutputfilterbytype deflate text/xml addoutputfilterbytype deflate text/css addoutputfilterbytype deflate application/xml addoutputfilterbytype deflate application/xhtml+xml addoutputfilterbytype deflate application/rss+xml addoutputfilterbytype deflate application/javascript addoutputfilterbytype deflate application/x-javascript
any appreciated, thanks.
try :
indexignore .htaccess directoryindex index.php options -indexes rewriteengine on rewritecond %{http_host} !^www\. rewriterule (.*) http://www.%{http_host}%{request_uri} [ne,r=301,l] #remove .php rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^([^.]+)/?$ /$1.php [l,nc] rewritecond %{the_request} /page\?u=([^\s]+) rewriterule ^ /page/%1? [ne,r,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/([^/]+)/?$ /page?u=$2 [l,nc]
Comments
Post a Comment