I'm trying to get my htaccess file to use this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
to rewrite this url:
http://cheesecakebb.org/index.php?action=vn
Try this instead:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index/([^/]+)/?$ index.php?action=$1 [QSA,L]
When someone clicks example.com/index/something, it will redirect (invisibly to the user) to index.php?action=something
Related
I just want to redirect from
mydomain.com/foo
to
mydomain.com/foo/bar
My root .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Any simple answer would be pretty appreciated.
You need to add RewriteRule ^foo/?$ /foo/bar [R=302,L] to the rewrites:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^foo/?$ /foo/bar [R=302,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
this is my htaccess:
RewriteEngine On
RewriteBase /
RewriteEngine on
RewriteCond %{HTTP_HOST} ^slople.com$
RewriteRule (.*) http://www.slople.com/$1 [R=301,L]
# pass the default character set
AddDefaultCharset utf-8
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?:.+/)?(\d+)/?$ index.php?slopeId=$1 [L,QSA]
#only rewrite if it's not a file and not /login/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/community/
#Wordpress-Regeln
#RewriteBase /community/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /community/index.php [L]
</IfModule>
Why does the URL http://www.slople.com/deutschland/hessen/buseck/alter-steinbruch/14231?language=DE, which should match this rule
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?:.+/)?(\d+)/?$ index.php?slopeId=$1 [L,QSA]
return a http 404?
I thought the "[L]" would stop execution of the later rules in htaccess?
Thanks
Raphael
Why can't the two rewrite rules work together and how to fix?
I'm trying to get wwww.mydomain.com/wordpress to wwww.mydomain.com/pages/wordpress.php
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^([a-z]+)(.*)$ /pages/$1.php [QSA,L]
Thanks,
You want the new rule before any of the wordpress rules:
RewriteEngine On
RewriteBase /
RewriteRule ^([a-z]+)(.*)$ /pages/$1.php [QSA,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
The wordpress rule routes everything to index.php, including whatever it was you're trying to match.
I've got old urls and want to remove the /index.php/ via .htaccess:
So old url is:
www.mysite.com/index.php/onesite.html
rewrite in .htaccess into
www.mysite.com/onesite.html
How can I do that?
Thx for your help
Adding the following code to your htaccess will allow this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index.php/(.*)$ www.mysite.com/$1 [R=302,L]
Changing 302 to 301 when you are sure the redirect is working
Try this one:
RewriteRule ^index.php/(.*?)$ http://%{HTTP_HOST}/$1 [R=301,L]
Just add this in your .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
If you site is in subfolder then
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]
</IfModule>
You can use these 2 rules in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^index\.php(/.*)?$ $1 [L,R=301,NC,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/?$ /index.php/$1 [L]
I am guessing this question has been asked many times, but i could not find one that would perhaps give me what I need.
So.. I can access the scripts by the following url's:
http://website.com/index.php/hello/world
http://website.com/hello/world
Both go to index.php which parses the input (hello/world in this example).
this is my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?path=$1&%{QUERY_STRING} [L]
</IfModule>
However. When the site is accessed like this:
http://website.com/index.php/hello/world
the RewriteRule outputs something similar to index.php?path=index.php/hello/world
I want to remove that index.php after path= in the RewriteRule
Your .htaccess file should look like this (notice the new rule that checks if index.php is a part of url):
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index.php/(.*)$ index.php?path=$1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?path=$1&%{QUERY_STRING} [L]
</IfModule>
Try this
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Modifying answer from Stackoverflow answer to suit this question
The .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Redirect user
RewriteCond %{THE_REQUEST} ^.*index.php.*
RewriteRule ^(.*)index.php(.*)$ $1$2 [NC,R=301,L]
# Handle the query to PHP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?path=$1&%{QUERY_STRING} [L]
</IfModule>