How to rewrite url in Symfony3 - .htaccess

i'm new in symfony. I'm trying to rewrite Url in symfony3. I change .htaccess in web folder but it didn't work.
The url is "/view/item/18", it should be "/view/item?view_detail_id=18". I just try sudo a2enmod rewrite but it didn't work.
I found this question for a long time but seem don't have more document or tutorial about it. Hope someone can help me.
Thanks for reading.

Related

Remove directory on dynamic links with .htaccess

I wrote the following codes with .htaccess
RewriteRule ^articles/([0-9a-zA-Z-_]+)$ page.php?article_seolink=$1 [NC,NE,L]
And I created the following URL address
example.com/articles/article-title
But I want to create a link like
example.com/article-title
How can I do this and redirect old URL to new one?
With your shown samples, please try following rules. Please make sure to place your htaccess Rules file inside articles folder. Please make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteRule ^([0-9a-zA-Z-_]+)$ page.php?article_seolink=$1 [NC,NE,L]

How to rewrite directories into query string

Yay, my first Stackoverflow question ever! Been around for years but this one gets me.
I have an URL:
https://example.com/site.com/phpBB3/general-f1/things-are-getting-crazy-here-t948-60.html
(I need to test this locally first which is why I have set it this way)
I want to change the URL into:
https://example.com/site.com/phpBB3/viewtopic.php?f=1&t=948&start=60
I have my .htaccess file in /example.com/.htaccess and the content is:
RewriteEngine On
RewriteRule ([a-z0-9_-]*-f)([0-9]+)\/([a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?f=$2&t=$4&start=$6 [QSA,NE,L,NC]
I have AllowOverRide set and the rewrite mod is enabled.
This seems to work in https://htaccess.madewithlove.be/
but not at the actual site. I'm going crazy. What's wrong with me?
This helped me to solve my problem https://techtitbits.com/2008/10/phpbb-redirect-broken-links-after-uninstalling-an-seo-mod/

htaccess file help needed for rewriting url

I need help from experts to solve my problem. I'm just starting to learn rewriterule, rbase, and rcond. I want to rewrite my site link like codeigniter MVC. For example:
http://localhost/app/index.php?page=profile&user=john -> http://localhost/app/index/page/profile/user/john
How to do that? I tried to change for many times, but i don't get url like that but error occured.
RewriteRule ^index/page/(.*)/user/(.*)$ /index.php?page=$1&user=$2 [L]

.htaccess redirect to subdirectory on Verio windows server

I've been trying to get a website up an running on my work's servers using Verio windows server 2003 gold and they've been quite useless when it comes to helping me out.
All I'm trying to do is set up a Wordpress installation, which they apparently require to be in a subdirectory. This is done and I have it in domain.com/wp ready to go. At this point they recommend that I use an .htaccess file to redirect to that url, so as they just sent me basically an "About .htaccess" link, that was of no help.
Did some searching, found a couple options like this one:
http://www.site5.com/blog/apache/htaccess/redirect-to-blog/20090427/
and nothing I use seems to work, not even as a straight redirect. Just gives me a "Directory Listing Denied - This Virtual Directory does not allow contents to be listed."
I do want to mention I did enable URL Rewrite for IIS via ISAPI_Rewrite 3 in the control panel.
As I mentioned Verio support is useless and I can't seem to find anything searching that seems to help my situation.
So pretty much what I need is domain.com/wp to rewrite as domain.com so all links centered around it do the same (ie domain.com/about domain.com/contact)
Any help? Thanks
If I understand you correct you need your Wordpress application to be available from the root of your web site instead of /wp/ folder? Then please try following .htaccess:
RewriteEngine on
RewriteRule ^(?!wp/)(.*) /wp/$1 [NC]
By the way I think you could try simply copying /wp/ folder content to the root folder.

.htaccess not working in subfolder

I have a couple of sites that are currently under development and I've put them under a specific subfolder for clients/co-workers to view - "http://dev.staffanestberg.com/site-name/". I've run into some problems getting the sites working with .htaccess. I can reach the index page by typing in the url for a site folder but neither img/style/js/etc linking or page rewriting works. Looking for a solution to this, Apache's "RewriteBase" seems to be the most likely one, however I can't get it to work.
Tried
RewriteBase http://dev.staffanestberg.com/site-name/
RewriteBase /site-name
What would be the correct method?
Thanks in advance,
-Staffan
mod_rewrite’s RewriteBase directive does only apply to rewrites using RewriteRule. And that does only apply for requests that are sent to the server.
But if the requested URIs are already wrong, RewriteBase doesn’t do any help. What you could try instead is the HTML element BASE that set’s the base URI for the current document.

Resources