I Tried every possible solution suggested , still my pages are completely unaffected
My URL
http://MyDomain/WCOM/Flatsome/pages/about-us/
is showing 404 on godaddy server but working find on WAMP ..
I have Tried following htaccess .
1.
DirectoryIndex index.php
AddDefaultCharset utf-8
RewriteEngine on
Options +FollowSymlinks -MultiViews -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /$1.htm [L]
2.
#Fix Rewrite
Options -Multiviews
# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /$1.htm [L]
Nothing is working .. What Can I do More ?
Related
I want to rewrite localhost/website/index.php?pages=pages/login.php to localhost/website/login
This was my attempt, when i open localhost/website/login it says 404 not found
RewriteEngine On
RewriteBase /Domain/
#Make sure it's an actual file
RewriteCond %{REQUEST_FILENAME} -f [OR]
#Make sure its a directory
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
#Rewrite the request to index.php
RewriteRule ^([^/]+)/?$ index.php?pages=pages/$1 [NC,L,QSA]
```
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteBase /website/login
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?pages=pages/login.php [QSA,L]
</IfModule>
Hello, I don't know exactly what you want to do, but try this
i am trying to redirect sub folder installation to root
ie. http://mydomain/auth/login its actually http://mydomain/test/web/index.php/auth/login
works fine with all urls
but not working if i am trying to access http://mydomain getting 403 Forbidden error
note
http://mydomain/index.php to http://mydomain/test/web/index.php is working
http://mydomain to http://mydomain/test/web/index.php is not working
i am looking to access http://mydomain without Forbidden error and /index.php in url
<IfModule mod_rewrite.c>
RewriteEngine On
Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /test/web/index.php/$1 [QSA,L]
</IfModule>
First you should exclude any URI start with /test/web/index.php at your code , so t should look like this :
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !/test/web/index.php
RewriteRule ^(.*)$ /test/web/index.php/$1 [QSA,L]
</IfModule>
Then , you could handle error request that passes a rule above .
Moreover , Options -Indexes , in short ,means prevent directory listing when there is no index page at that directory , your code should look like this :
DirectoryIndex /test/web/index.php
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} /index [NC]
RewriteCond %{REQUEST_URI} !/test/web/index.php
RewriteRule ^ / [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !/test/web/index.php
RewriteRule ^(.*)$ /test/web/index.php/$1 [QSA,L]
</IfModule>
Note: clear browser cache then test it .
My current url is
http://localhost/www.zeeshan.com/user.php?name=zeeshan06
I want to display my url as
http://localhost/www.zeeshan.com/user/zeeshan06
I use the following code but it not working
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Options +FollowSymlinks
RewriteBase /
RewriteRule ^user/(.*)user.php?name=$1 [R]
Please help me to solve my problem. Thanks.
If you place this .htaccess inside the folder www.zeeshan.com:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /www.zeeshan.com/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^user/([^/]+)$ user.php?name=$1 [NC,L]
And access the URL:
http://localhost/www.zeeshan.com/user/zeeshan06
It should lead you to:
http://localhost/www.zeeshan.com/user.php?name=zeeshan06
// http://localhost/Milan_Practice/Milan_Mvc/routing.php?name=about
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^(GET|HEAD|POST)\ /Milan_Practice/Milan_Mvc/routing\.php\?name=([^&]+)
RewriteRule ^ /Milan_Practice/Milan_Mvc/routing/%2/%3?%4 [L,R=301]
RewriteRule ^/?Milan_Practice/Milan_Mvc/routing/([0-9]+)/(.*)$ /Milan_Practice/Milan_Mvc/routing.php?name=$1 [L,QSA]
I need to rewrite my url
http://midogames.com/game.php?id=%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8
to
http://midogames.com/%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8
"please note they are spaces in the link"
i am doing this
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+) /game.php?id=$1 [NC,L]
</IfModule>
but it did not work with me, any suggetion
Try with NE flag:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+game\.php\?id=([^\s&]+) [NC]
RewriteRule ^ /%1/? [R=302,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ game.php?id=$1 [NE,L,QSA]
It is possible to rewrite my url using mod_rewrite and htaccess where a user could enter:
http://www.mainsite.com/12345
which the server would translate as:
http://www.mainsite.com/index.php?ID=12345
By also trying to remove the file extension from all pages, (remove .php) it conflicts and causes a never ending redirect:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.php$ $1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z]+)$ index.html?ID=$1 [QSA,NC,L,R]
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)$ index.php?ID=$1