is it possible to mask the url without breaking the structure?
I use LARAVEL
For example:
URL original:
https://site.test/public/store-owner/dashboard
URL masked
https://site.test/public/vendedor/panel
However, all the previous requests are not lost with the original url and the url in the address bar stays with the masked url
My .htaccess file in proyect
I have this code but the url changes in the address bar to the original one.
What I need is that the url mask does not change
RewriteEngine on
RewriteRule ^public/vendedor/panel/?$ public/store-owner/dashboard? [NC]
------------------------
FileETag none
<IfModule mod_rewrite.c>
RewriteEngine On
#Redirect to non-www with https
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# BEGIN Caching
<ifModule mod_headers.c>
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|ttf|otf|woff|woff2|eot|svg)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\\.(css)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
#<filesMatch "\\.(js)$">
#Header set Cache-Control "max-age=2592000, private"
#</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=2592000, public, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|html|php)$">
Header set Cache-Control "no-store"
</filesMatch>
</ifModule>
# END Caching
<FilesMatch ".(eot|otf|ttf|woff|woff2)">
Header always set Access-Control-Allow-Origin "*"
</FilesMatch>
<Files .json>
Header unset Cache-Control
</Files>
<Files .env>
order allow,deny
Deny from all
</Files>
RewriteEngine On
RewriteBase /
#force https and non-www
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]
# profile redirection
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(.*)\.site.test [NC]
RewriteRule (.*) https://site.test/stores/%1/$1 [L]
Not Sure this works. But just give a try
RewriteEngine on
RewriteRule ^vendedor/panel/?$ public/store-owner/dashboard? [NC]
Related
htaccess mod_rewrite.c: soy of OFF I can't let it
https://www.manexauto.com/itest.php
OpenCart
the hosting is winodws server 2016 IIS I tried a lot of things on the internet but it didn't work
htaccess
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
<IfModule mod_suphp.c>
Header set X-SuPHP-Works 1
</IfModule>
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) /index.php?_route_=$1 [L,QSA]
#RewriteCond %{HTTP_HOST} ^www
#RewriteRule (.*) http://www.manexauto.com/$1 [R=301,L]
#RewriteRule (.*) http://www.manexauto.com/autoparts/$1 [R=301,L]
#RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
#RewriteRule ^sitemap.xml$ index.php?route=feed/simple_google_sitemap [L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Fix Icons
<FilesMatch ".(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
New to htaccess... All files exist despite 404. There are actual 50+ images in this one folder but 3 images are getting a slash added to the end.
not working:
http://shawnrieger.dev/img/photography/small/20100402153906_s.jpg/
http://shawnrieger.dev/img/photography/small/20140404123054_s.jpg/
http://shawnrieger.dev/img/photography/small/20130330110114_s.jpg/
an example of working:
http://shawnrieger.dev/img/photography/small/20160913190428_s.jpg
http://shawnrieger.dev/img/photography/small/20120613091849_s.jpg
http://shawnrieger.dev/img/photography/small/20120713102800_s.jpg
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^privacy-policy/$ /parts/pages/privacy-policy.php
RewriteRule ^project/([^/]+)/$ /parts/pages/project.php?id=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
<IfModule mod_headers.c>
# WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
# WEEK
<FilesMatch "\.(js|css|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
</IfModule>
You must avoid adding trailing slash for real files and also reorder your rules.
Have it like this:
<IfModule mod_headers.c>
# WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
# WEEK
<FilesMatch "\.(js|css|swf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule [^/]$ %{REQUEST_URI}/ [L,R=301,NE]
RewriteRule ^privacy-policy/$ /parts/pages/privacy-policy.php [L,NC]
RewriteRule ^project/([^/]+)/$ /parts/pages/project.php?id=$1 [L,NC,QSA]
Make suer to clear your browser cache before you test this change.
After enabling https on all site I'm getting (500 Internal Server Error ) when I browse anything with friendly url,
But the links without friendly url are Ok,
Here is my htaccess file:
#Options +FollowSymLinks
#Options -MultiViews
#Options All -Indexes
# This can be uncommented to compress js and css files
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# This can be uncommented to set cache control for image, js, and css files
#Header unset ETag
#FileETag None
#<FilesMatch "(?i)^.*\.(ico|flv|swf|jpg|jpeg|png|gif|js|css)$">
#Header unset Last-Modified
#Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
#Header set Cache-Control "public, no-transform"
#</FilesMatch>
<FilesMatch "\.(htaccess|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteRule ^([a-zA-Z]+)\.html$ $1.php [L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.uae-shipping.net/$1 [R,L]
#Handle all category links. Static category text followed by ID, followed by path
#The "category" text here needs to be changed if the language variable category is changed
RewriteRule ^category\/(.+/)location/(.+)$ browse_categories.php?id=$1&location=$2 [L,NC,QSA]
RewriteRule ^category\/(.+)$ browse_categories.php?id=$1 [L,NC,QSA]
#Handle all location links. Static location text followed by ID, followed by path
#The "location" text here needs to be changed if the language variable location is changed
RewriteRule ^location\/(.+)$ browse_locations.php?id=$1 [L,NC,QSA]
#Rewrite pages
RewriteRule ^pages\/(.+)\.html$ page.php?id=$1 [L,NC]
#Rewrite Blog
RewriteRule ^blog.html$ blog.php [L,NC,QSA]
RewriteRule ^blog\/([^/]+)-([0-9]+).html$ blog_post.php?id=$2 [L,NC]
RewriteRule ^blog\/category\/(.+)-([0-9]+).html$ blog.php?category_id=$2 [L,NC,QSA]
#Rewrite listing/banner website out
RewriteRule ^out-([0-9]+)\.html$ out.php?listing_id=$1 [L]
RewriteRule ^out-([0-9]+)-([0-9]+)\.html$ out.php?listing_id=$1&banner_id=$2 [L]
#Rewrite listings
#Ignore any physical files
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)\.html$ listing.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/images\.html$ listing_images.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/send-message\.html$ listing_email.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/send-message-friend\.html$ listing_email_friend.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/reviews\.html$ listing_reviews.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/add-review\.html$ listing_reviews_add.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/classifieds\.html$ listing_classifieds.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/documents\.html$ listing_documents.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/events\.html$ listing_events.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/suggestion\.html$ listing_suggestion.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/claim\.html$ listing_claim.php?id=$1 [L,NC]
#Rewrite classifieds
RewriteRule ^classified/[^/]+-([0-9]+)\.html$ classified.php?id=$1 [L,NC]
RewriteRule ^classified/[^/]+-([0-9]+)/images\.html$ classified_images.php?classified_id=$1 [L,NC]
#Rewrite events
RewriteRule ^event/[^/]+-([0-9]+)\.html$ event.php?id=$1 [L,NC,QSA]
#Rewrite sitemap
RewriteRule ^sitemap.xml$ xml.php?type=sitemap [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ 404.php?id=$1 [L,NC]
</IfModule>
My htaccess
Options -Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
DirectorySlash Off
AddDefaultCharset UTF-8
SetEnv TZ Asia/Bsngkok
DefaultLanguage th
ContentDigest On
SetEnv SERVER_ADMIN aaa#aaa.com
RewriteCond %{HTTP_HOST} ^aaa.com$ [NC]
RewriteRule ^(.*)$ http://www.aaa.com/$1 [R=301,L]
##### Add trailing slash ####################################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.aaa.com/$1/ [R=301,L]
RewriteRule ^(.*)/$ /$1.php [L]
RewriteRule ^audio/([^/\.]+)/?$ /pages/viewAudio.php?id=$1 [L]
<filesMatch "\.(ttf|woff|woff2|eot)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch ".(php|cgi)$">
Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
</filesMatch>
<files .htaccess>
order allow,deny
deny from all
</files>
When I go to http://www.aaa.com/audio/test it's loop and has a lot of php like http://www.aaa.com/audio/test.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php.php/ but I want http://www.aaa.com/audio/test.
That's my way. I change logic and it work fine
<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
#CustomURL With parameter
RewriteRule ^audio/([A-Za-z-\s0-9]+)/$ /pages/viewAudio.php?slug=$1 [L]
</IfModule>
to rewrite pages like:
mysite.com/eng/cat
to redirect to:
mysite.com/eng?sentence=cat
I made the following rewrite rule:
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1? [R=301,NC,L]
but when i request
mysite.com/eng/cat
it rewrites like this
mysite.com/eng?sentence=cat?
i dont know why it puts a question mark at the end, i also tried
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1 [R=301,NC,L]
and
RewriteCond %{THE_REQUEST} ^GET\ /eng/([^&\s]+) [NC]
RewriteRule ^eng/ eng\?sentence=%1\? [R=301,NC,L]
which dont make any difference. any help?
my htaccess file:
# Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php54s .php
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\s/+eng/([^/?&\s]+) [NC]
RewriteRule ^ eng?sentence=%1 [R=302,NC,L,NE]
AddType application/x-httpd-php .htm .html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options -Indexes
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
Just this rule should work:
RewriteCond %{THE_REQUEST} ^GET\s/+eng/([^/?&\s]+) [NC]
RewriteRule ^ eng?sentence=%1 [R=302,NC,L,NE]
Make sure to test in a different browser to avoid 301 caching pitfall.
Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.
Suggested htaccess file:
# Use PHP5.3 Single php.ini as default
AddHandler application/x-httpd-php54s .php
AddType application/x-httpd-php .htm .html
Options -Indexes -MultiViews
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\s/+eng/([^/?&\s]+) [NC]
RewriteRule ^ /eng?sentence=%1 [R=302,NC,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>