I am trying to convert my url it query string to slash using htaccess but its not wokring.its a wordpress as a cms
Here is what i have done
http://mycouserweb.co.au/courses?month=02&cyear=2018
to
http://mycouserweb.co.au/courses/month/05/cyear/2017
My htaccess.
RewriteRule ^courses/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ courses?month=$1&cyear=$2 [NC,L]
Related
I am trying to mask the following url with any page number using htaccess.
https://sampledomain.com/?page=2
to
https://sampledomain.com/page/2
So if we call https://sampledomain.com/page/2 url in the website, internally path should always be calling https://sampledomain.com/?page=2 url
Please suggest me the correct htaccess rule.
In htaccess in your document root, use the following rule :
RewriteEngine on
RewriteRule ^page/([0-9]+)/?$ /?page=$1 [QSA,L]
the below htaccess code work for single URL with same page
RewriteRule ^([^/]*)\.html$ /current/shoppe/sub-category.php?category=$1 [L]
now, i need to rewrite a URL of another page.
We want to remove specific characters from the url using htaccess.
for example http://www.example.com/#/music.php which is redirect to http://www.example.com/music.php using htaccess rules.
we used the following code but its not working
RewriteEngine On
RewriteRule ^\.html$ /#/music.php [L]
I have a website on a test server and I want to rewrite URL for this website because it is very long
I wish our visitors instead of entering this URL:
http://staging.company.fr/site2.it/s...oject2/public/
enter this URL:
www.monsite.com
I created a file. htaccess:
RewriteEngine On
RewriteRule ^/~(.+) http://www.monsite.com/~$1 [NC,L]
but does not work
While in .htaccess mod_rewrite doesn't match leading slash in a URL since it is applied per directory. Therefore following should work:
RewriteEngine On
RewriteRule ^(.+)$ http://www.monsite.com/$1 [L,R=301,NE]
This will redirect every URL in your existing domain other than home / to monsite.com
Reference: Apache mod_rewrite Introduction
My old website URL structure was something like this:
http://www.example.com/index.php?go=archives&data=lastweek
Today, I migrated to CakePHP, so that URL won't work. So I want to redirect it to this URL:
http://www.example.com/archives/find?data=lastweek
(I don't want to change query string to action parameter, for some reason, I should keep it as a query string.)
What should I do? (edit which .htaccess file? CakePHP has 3 files!)
In the htaccess file in your document root (preferably above any rules that may already be there), add these:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^go=archives&data=([^&]+)
RewriteRule ^/?index.php$ /archives/find/?data=%1 [L,R=301]
This should 301 redirect /index.php?go=archives&data=anything to /archives/find?data=anything.