logo
down
shadow

.htaccess url rewrite GET parameter and remove .php without breaking javascript/css


.htaccess url rewrite GET parameter and remove .php without breaking javascript/css

By : Julia Suhendra
Date : November 19 2020, 01:01 AM
around this issue Sorry if I explain my problem badly, It's a little hard to explain what's going wrong* , You can replace your current code by this one in your htaccess
code :
Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

# rewrite /generator.php?t=XXX to /generator/XXX
RewriteCond %{THE_REQUEST} \s/generator\.php\?t=([^\s&]+)\s [NC]
RewriteRule ^ generator/%1? [R=301,L]

# hide PHP extension for existing files
RewriteCond %{THE_REQUEST} \s/(.+?)\.php(?:\s|\?) [NC]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ %1? [R=301,L]

# internally rewrite /generator/XXX to /generator.php?t=XXX
RewriteRule ^generator/([^/]+)$ generator.php?t=$1 [L]

# internally rewrite to PHP file extension (if existing)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+)$ $1.php [L]


Share : facebook icon twitter icon
Rewrite a url with one non-breaking space in .htaccess

Rewrite a url with one non-breaking space in .htaccess


By : user2428191
Date : March 29 2020, 07:55 AM
seems to work fine I have the following url (there are a few like these): , You can have it like this:
code :
# take care of %C2%A0
RewriteRule ^(.+)\xc2\xa0(.+)$ $1-$2 [L,NE]

# executes **repeatedly** as long as there are more than 1 spaces in URI
RewriteRule "^(\S*) +(\S* .*)$" $1-$2 [L,NE]

RewriteRule "^productdetails/617/6/(\S*) (\S*?)/?$" /$1-$2/302 [L,R=302,NE]

RewriteRule "^productdetails/408/20/(\S+?)/?$" /$1-in-Black/393 [L,R=302,NE]
How can add parameter in htaccess for rewrite condition in htaccess

How can add parameter in htaccess for rewrite condition in htaccess


By : Chris Dryden
Date : March 29 2020, 07:55 AM
this will help I have a below HTACCESS file
code :
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+viewgallery\.php\?cname=([^&\s]+)&pcaption=([^&\s]+)&q=([^&\s]+)
RewriteRule ^ /photos/%1/%2/%3/? [R=301,L]
RewriteRule ^photos/([^/]+)/([^.]+)/([^.]+)/$ /viewgallery.php?cname=$1&pcaption=$2&q=$3 [L,NE] 
htaccess rewrite query string to folder breaking $_GET

htaccess rewrite query string to folder breaking $_GET


By : Burak Seyhan
Date : March 29 2020, 07:55 AM
I hope this helps . , Try turning option MultiViews off:
code :
Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_METHOD} =POST
RewriteRule ^ - [L]

RewriteCond %{THE_REQUEST} \ /view\?i=([0-9]+)
RewriteRule ^ /view/%1? [L,R]

RewriteRule ^view/([0-9]+)$ /view?i=$1 [NC,L,QSA]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_FILENAME}.php [L]
Remove just one GET parameter from url and rewrite another if a certain GET param isn't present - htaccess

Remove just one GET parameter from url and rewrite another if a certain GET param isn't present - htaccess


By : Lunight
Date : March 29 2020, 07:55 AM
seems to work fine Assuming your parameters are sometimes product and always retailer and site (in that order), your rules should look like this
code :
# first condition
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{QUERY_STRING} ^product=([^&\s]+)&retailer=([^&\s]+)&site=test$ [NC]
RewriteRule ^$ /?product=%1&retailer=%2 [R=301,L]

# second condition
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{QUERY_STRING} ^retailer=([^&\s]+)&site=test$ [NC]
RewriteRule ^$ /retailer/%1? [R=301,L]
.htaccess rewrite rule breaking css

.htaccess rewrite rule breaking css


By : Oluwaxheun Abayomi P
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , The problem is due to Capitalized file name Version.css.
If your devbox is windows it'll work. Windows is case insensitive.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org