I want to create a custom url for my domain.
for example i want url like this:- mysite.com/ERJDII787HUKKS
Instead of :- mysite.com/index.php?args=ERJDII787HUKKS
I have tried this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^$ /index.php/$1 [L]
But its not working well please help!!
Try below rule in your root directory
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([\w-]+)$ index.php?args=$1 [L]
The regex you are using is empty, so it can't match any URL you are trying to access. And you should rewrite it you your real URL. Try using this:
RewriteRule ^(.*)$ /index.php?args=$1 [L]
I hope that solves your problem.
Related
I am trying to change my url to try to stop it from showing the language folder in the url for example:
change from
www.site.com/en
change to
www.site.com
so I am looking to remove the
en
from the url but still accessing that directory. This is what I have so far but it does not seem to do the trick:
RewriteEngine on
RewriteBase /mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .+ en=$0 [L,QSA]
Thank you.
This should do it:
RewriteEngine on
RewriteBase /mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ en/$1 [L,QSA]
My URL is :
http://example.com/demo/my_list.php?id=122&name=test files
Wan't to change this into:
http://example.com/demo/my_list.php/test files/122
Currently My htaccess is as followes,
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?id=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ my_list.php?id=$1&name=$2 [L]
but its not working...
How to rewrite url in php with more than two GET variables?
Where I placed my htaccess file? inside the 'demo' folder or in root path?
Please any one help...
Use it like this,
RewriteRule ^my_list\.php/([^/]+)/([^/]+)$ my_list.php?id=$2&name=$1 [L]
I got a webpage that has the following URL:
localhost/Minecraft-User-Info/player/?user=matthijs110
Now I want it to localhost/Minecraft-User-Info/player/matthijs110
So without ?user=matthijs110
I tried different ways, but it doesn't seem to work. Mod_Rewrite is enabled.
What can I do to get this to work?
Give this a try.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Minecraft-User-Info/player/(.+)$ /Minecraft-User-Info/player/?user=$1 [L]
Edit:
Use this since it's in a sub directory.
RewriteEngine On
RewriteBase /Minecraft-User-Info/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^player/(.+)$ player/?user=$1 [L]
Updated to show my original answer and included the edit per users comment about where htaccess is located.
Try this instead. Minecraft-User-Info/player/username Redirects to Minecraft-User-Info/player/index.php?user=username
Tested on http://htaccess.madewithlove.be/ instead of setting up my own server for it.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Minecraft-User-Info/player/(.+)$ /Minecraft-User-Info/player/index.php?user=$1 [L]
Try this
RewriteRule ^Minecraft-User-Info/player/([a-zA-Z0-9_-]+)\$ index.php?playerId=$1
i'm trying to make a codeigniter based website be able to convert index.php?option=test&controller=con1 to /test/con1 using .htaccess i tried multiple examples i found and none seem to work, it goes straight to the home page. any ideas?
i've tried things like
RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$
RewriteRule ^\/(.+?)\/(.+?)\/? /index.php/$1/$2 [L]
but doesn't throw any errors or anything.
my current htacces is
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|img|js|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
try put this .htaccess in same directory with your index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
I am having a tough time to understand how mod_rewrite works.
I have a url like this:
www.example.com/store/index.php?categ=headbands
And I want to make it look like this:
www.example.com/store/headbands
I am trying this, but not working:
RewriteEngine on
RewriteBase /store/
RewriteRule ^index/([^/\.]+)/?$ $1 [L]
And I confirmed the mod_rewrite is activated with a random example I found.
Any suggestions?
Thanks!
Try This one
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^/store/(.*)$ /store/index.php?categ=$1 [NC,L]
OR
Put the .htaccess file inside the "store" directory with following code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?categ=$1 [NC,L]