Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Please I have this url
http://sub.maydomaine.com/wallpapers.php?category=cities&name=San%20francisco
I want redirect to
http://sub.maydomaine.com/wallpapers/cities/San%20francisco
Please help me .
If you add this rewrite rule, you should be able to support both urls:
RewriteRule ^wallpapers/([^/]+)/([^/]+)$ wallpapers.php?category=$1&name=$2 [QSA]
Hope this helps.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 days ago.
Improve this question
Please can you help to correct a rewrite rule on a wordpress website.
My urls are like this one :
https://mywebsite.fr/activity/city/?location_search=city+region+country+&tax-listing_category=Activity
I want this url :
https://mywebsite.fr/activity/city/
So I need to remove everything after "activity/city/"
I tried this but not working :
RewriteRule ^([-a-z_]+)/([-a-z_]+)$ /$1/$2/^ [NC,L,QSA]
EDIT :
The urls are like this because it's wordpress pages (hierarchical structures parent-page/child-page/) and I add in the urls parameters to pre-fill the search-form in the page
You can have a look here : bit.ly/3RUybZD
If you try to remove all parameters from the url, you will see the search-form and listings updated
Thx
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I want to redirect this url:
domain.asd/category/node123/attachment/file123
to this one:
domain.asd/category/node123
by removing the attachment/fn1aa from the end.
Only the node123 and the file123 are dynamic.
The code below working, but it's valid, safe and resource-friendly?
RedirectMatch permanent category(.*)attachment /category/$1
Any recommendation are welcome. thx.
Try:
RedirectMatch permanent ^/category/([^/]+)/attachment /category/$1
It's more strict and won't duplicate forward slashes (/). Your regex will also match things like this:
domain.asd/foo/something/category/a/b/c/d/e/f/some-attachment
by redirecting to:
/category//a/b/c/d/e/f/some-
which probably isn't what you want to do. It's safe and as resource friendly as it is using an htaccess file (which is slight performance hit as opposed to putting this in the vhost config).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a problem with a url a .htaccess.
I need that all url like : http://mywebsite.com/api/something go to my api/index.php cause I need to write a routing system from this place.
The .htacces must be inside the api/ folder.
What I'm trying to do here ,is a routing system who includes differents content inside the api/index.page depending on the url used.
For exemple if I go to http://mywebsite.com/api/activity I want to include a specific file without changing the url.
Do you think it's possible ? Have you an idea of the .htaccess content ?
Thanks for your help.
I've finally found the solution by myself so I post the solution, that may help another person later :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) index.php [PT,QSA]
</IfModule>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am completely new to ht-access and I am not sure that this is the correct way to do this.
On my WordPress site, I have the current url:
http://www.example.com/category/travel/
And would like to map this to:
http://www.example.com/kids-vaction-spots/
So any post under the category travel would look like:
www.example.com/kids-vaction-spots/beach-holidays
Is it possible to have a rule in the htaccess that does this?
Thank you for taking the time to look at this.
Try adding these rules to the htaccess file in your document root. Make sure they're above any rules that do routing for a CMS.
RewriteEngine On
RewriteRule ^/?category/travel/(.*)$ /kids-vacation-spots/$1 [L,R=301]
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm trying to get the string /index.php?page=home behind the adress in de adressbar when people visit the root of my site.
I tried rewrite rules in .htaccess but it redirects to the .php without any css etc.
Like this:
RewriteRule (.*) index.php?page=home
I tried javascript rewrite but it reloads the page
Like this:
window.location.href = "/index.html?page=home"
My page already takes the arguments and follow a javascript function, but I would like to just simply add something to the current URL in the bar, without reloading or doing anything else.
Any ideas?
By the sound of it, you'll have to use the hash to do what you want. You can go from http://example.com/#home to http://example.com/#contact without reloading the page, but you cannot go from http://example.com/index.php?page=home to http://example.com/index.php?page=contact without reloading the page.
You can set and read from the hash using window.location.hash in javascript.