My URL: https://domain.com/my-team-league/viewgroup/201-crick
Needed URL: https://domain.com/league/201-crick
Help me to take out of this url issue please
.htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteRule ^/league/(.+) /my-team-league/viewgroup/$1
Use the opposite (and without /):
RewriteEngine on
RewriteRule ^my-team-league/viewgroup/(.+) league/$1 [R=302,L]
Try with [R=302,L] and after, when that work well, change for [R=301,L]
Related
This is right links:
http://digitalpoint.com.bannedadsense.com
http://businessinsider.com.bannedadsense.com
http://caradvice.com.au.bannedadsense.com
http://bannedadsense.com/index.php
And here is wrong link:
http://bannedadsense.com/
http://bannedadsense.com
This is htaccess code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^/?(.*).html$ index.php?domainname=$1 [L]
you can see the title of this post, it is problem. or when you go to bannedadsense.com you will see it redirect to new bad url, it should be still in homepage, now it wrong. If you go to bannedadsense.com/index.php then no problem. I need to fix this problem.
Please help me fix the problem in htaccess.
Add that in your .htaccess:
RewriteRule ^/?$ /index.php [R=301,L]
try this,
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_URI} ^$
RewriteRule ^$ http://%{HTTP_HOST}%1 [R]
Please i need help to create a correct instruction in .htaccess to redirect old urls done in this way:
/it/cartelle/465-piquadro-signo-cartella-ca1744si.html
to
/it/valigeria/cartelle/465-piquadro-signo-cartella-ca1744si-ca1744si.html
in other words we have shifted all category cartelle under category valigeria.
Our .htaccess at the moment is:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.it$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
Anyone can help me?
Thanks
You can try this if you want to redirect to a new URL:
RedirectMatch /it/cartelle/(.*) /it/valigeria/cartelle/$1
If you want to keep the old url and just do an internal redirect:
RewriteRule ^/it/cartelle/(.*)$ /it/valigeria/cartelle/$1 [NC,L]
I want redirect all requested files from folder-a to folder-b. E.g. http://www.yoursite.com/folder-a/index.php to http://www.yoursite.com/folder-b/index.php.
How can I do that? I have verified if mod_rewrite works with this code:
RewriteEngine On
RewriteRule ^google.html$ http://www.google.com/ [R=301]
The structure on the webspace is the following:
.htacces
|-folder-a
|-folder-b
But if I want my folder redirect
RewriteEngine On
RewriteRule ^/folder-a/(.*)$ http://www.yoursite.com/folder-b/$1 [L,R=301]
the redirect doesn't work if I input the following URL:
http://www.yoursite.com/folder-a/
http://www.yoursite.com/folder-a/index.php
The redirect doesn't take place. I stay on the same page ... What I'm doing wrong? I also tried it with this htaccess:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^folder-a(.*)$ http://www.yoursite.com/folder-b$1 [L,R=301]
</IfModule>
If all this works I want to exclude some files. Eg. with this htaccess:
RedirectPermanent /folder-a/info.php /folder-b/new-info.php
Edit:
Now I tried this htaccess
redirectMatch 301 ^/folder-a/ http://www.yoursite.com/folder-b
This works, but I need something which takes the whole path and rewrite it to the new folder.
This for example doesn't work:
RewriteRule ^folder-a/(.*)$ folder-b/$1
Solution
I had an old htacess file in my folder-a so the redirect didn't worked. This is my final htaccess:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^folder-a/excludefile1.php http://www.yoursite.com/folder-b/newnameforfile1.php [L,R=301]
RewriteRule ^folder-a/excludefile2.php http://www.yoursite.com/folder-b/newnameforfile2.php [L,R=301]
RewriteRule ^folder-a/(.*)$ http://www.yoursite.com/folder-b/$1 [L,R=301]
</IfModule>
You probably need to put both rules in place: one for the empty folder and one for other files, and then the catch-all at the bottom. This is not tested:
RewriteEngine On
RewriteRule ^folder-a/info.php http://www.yoursite.com/folder-b/new-info.php [L,R=301]
RewriteRule ^folder-a/ http://www.yoursite.com/folder-b/ [L,R=301]
RewriteRule ^folder-a/(.*)$ http://www.yoursite.com/folder-b/$1 [L,R=301]
I'm having some problems in my .htaccess file.
I would like to display the content of this URL:
http://mywebsite.com/admin/payments/invoices/view/index.php?id=123456
When I access this one:
http://mywebsite.com/admin/payments/invoices/view/123456/
Here's my actual .htaccess
Options +FollowSymlinks
RewriteEngine On
RewriteBase /admin/payments/invoices/
RewriteRule ^/view/([0-9]+)/(index.php)?$ /view/index.php?id=$1 [L,QSA]
Do you have any idea?
Thanks!
If you do have the view directory, then the easiest thing is to put this .htaccess in that directory (i.e. {DOCUMENT_ROOT}/admin/payments/invoices/view/.htaccess):
Options +FollowSymlinks
RewriteEngine On
RewriteBase /admin/payments/invoices/view
RewriteRule ^(\d+)$ index.php?id=$1 [L,QSA]
The index.php in the left side hand of the RewriteRule is not required (actually, I expect it not to work: the DirectoryIndex should not yet have been injected in the URI at this stage - unless some other RewriteRule is in effect?), nor is the / at the end of the RewriteBase.
I tested the above on Apache/2.2.21, but the module rules are the same for later versions.
Try this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^.*admin/payments/invoices/view/index\.php\?id=([0-9]+) admin/payments/invoices/view/$1/index.php [L]
</IfModule>
Try putting this in the htaccess file in your document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)id=([0-9]+)
RewriteRule ^admin/payments/invoices/view/index\.php$ /admin/payments/invoices/view/%1/index.php [L]
So when you enter http://mywebsite.com/admin/payments/invoices/view/index.php?id=123456 in your browser's URL address bar, you will get served the content at /admin/payments/invoices/view/123456/index.php. Since it's completely unclear what you actually want, in case you wanted it the other way around:
RewriteEngine On
RewriteRule ^admin/payments/invoices/view/([0-9]+)/(index.php)?$ /admin/payments/invoices/view/index.php?id=$1 [L,QSA]
I am trying to permanently redirect a url but it doesn't seem to work, this is what I have in the .htaccess file
RewriteEngine on
rewriteRule ^modules\.php?name=My_Page$ http://mysite.net/mypage [R=permanent,L]
As you can see I want to redirect modules.php?name=My_Page to http://mysite.net/mypage
I appreciate any help. Thanks
The path used in RewriteRule doesn't contain the querystring. Use
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^name=My_Page$
rewriteRule ^modules\.php$ /mypage? [R=permanent,L]