URL Rewriting with .htaccess redirects - .htaccess

i am trying to Generate
http://example.com/file/1.php?name=the-file-name-any&id=32vr&code=1548393
to
http://example.com/file/the-file-name-any.32vr/1548393
but i am not success
my .htaccess redirect code
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /file/1.php?the-file-name-any=$1&id=$2&code=$3 [L]

Try using this rule:
RewriteEngine On
RewriteRule ^file/([^/]*)/([^/]*)/([^/]*)$ /file/1.php?name=$1&id=$2&code=$3 [L]
Make sure it is at the top of your .htaccess and you've cleared your cache before testing.

Related

Rewrite htaccess url and remove extension

I'm trying to rewrite and remove extension
http://www.example.com/pages/cart.php
to
http://www.example.com/cart
My htaccess file is located in the public folder.
RewriteEngine On
RewriteRule (.*) pages/$1 [L]
With your shown attempts, please try following htaccess Rules. Make sure you keep your htaccess file along with pages folder(not inside it).
Also make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{THE_REQUEST} \s/pages/(cart)\.php\s [NC]
RewriteRule ^ /%1? [R=301,L]
RewriteRule ^(.*)/?$ pages/$1.php [L]

Remove directory in URL [HTACCESS]

I'm using this in my .htaccess file...
Redirect /index.html http://jurrasicgames.net/JurrasicGamesDatFile/Index.html
Redirect /VIP.html http://jurrasicgames.net/JurrasicGamesDatFile/VIP.html
Redirect /sg.html http://jurrasicgames.net/Soon.SHMTL
Redirect /kitpvp.html http://jurrasicgames.net/JurrasicGamesDatFile/kitpvp.html
I want http://jurrasicgames.net/JurrasicGamesDatFile/kitpvp.html to look like http://jurrasicgames.net/KitPVP is there any way to do this?
Don't use Redirect directive as it does a full redirect. Use internal rewrite instead.
.htaccess to be used in site root ( a level above JurrasicGamesDatFile )
RewriteEngine On
RewriteRule ^index\.html$ JurrasicGamesDatFile/Index.html [L,NC]
RewriteRule ^VIP\.html$ JurrasicGamesDatFile/VIP.html [L,NC]
RewriteRule ^sg\.html$ Soon.SHMTL [L,NC]
RewriteRule ^kitpvp\.html$ JurrasicGamesDatFile/kitpvp.html [L,NC]
Make sure to clear your browser cache before testing it.

How do I redirect in .htaccess file without changing URL

I want to redirect several pages to a PHP page with GET variables. However, when I try to use an .htaccess file, it redirects but changes the URL. I don't want it to change the URL structure when redirecting. How would I do this?
For example, I want to redirect /fly-snooze-cruise to http://example.com/package_listing.php?package-type=fly-snooze-cruise
and /fly-snooze-cruise/orlando-airport to http://example.com/package_listing.php?package-type=fly-snooze-cruise&airport=orlando-airport
Here is my .htaccess code:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^fly-snooze-cruise$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise [L]
RewriteRule ^fly-snooze-cruise/orlando-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=orlando-airport [L]
RewriteRule ^fly-snooze-cruise/orlando-sanford-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=orlando-sanford-airport [L]
RewriteRule ^fly-snooze-cruise/melbourne-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=melbourne-airport [L]
RewriteRule ^snooze-park-cruise$ http://www.example.com/package_listing.php?package-type=snooze-park-cruise [L]

url cleanup with .htaccess rewrite mode url cleanup

i have htaccess problem.
i want use htaccess rewrite mode for change this url:
http://somedomain.com/?id=https://play.google.com/store/apps/details?id=com.supercell.clashofclans
to this:
http://somedomain.com/?id=com.supercell.clashofclans
I've folowed some .htaccess tutorials but I couldn't. How can I make it work?
This should work for you:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=(.*)?id=(.*)
RewriteRule ^$ /?id=%2 [L,R=301]

.htaccess RewriteRule slash to get parameter

I just transfered my Domain to a new Server. Mod_Rewrite is enabled on the new server but unfortunately some RewriteRules don't work, while others do. I haven't changed anything in the .htaccess
So the URL www.mydomain.com/go/10.html should make an internal redirect to www.mydomain.com/go.php?name=10
The snippet in the .htaccess looks like this:
# go.php
RewriteRule ^go$ "$0/" [R=301,L,QSA]
RewriteRule ^go/$ go.php [L,QSA]
RewriteRule ^go/.*?([^\.\/]*)\.html$ go.php?name=$1 [L,QSA]
The $_GET["name"] is not available if I call this url.
Replace your .htaccess code with this.
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(go)/([^.]+)\.html$ /$1.php?name=$2 [L,QSA,NC]

Resources