url rewriting using .htaccess giving CSS error - .htaccess

I have a website with url mydomain.com/about.php?see=help
I want to rewrite it to some simple url.
I rewritten it to be mydomain.com/help.htm using the following code written at my .htaccess file which works perfectly fine.
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.htm$ about.php?see=$1
But I want to use mydomain.com/about/help I'm using the following code to achieve it but it gives error. The page is opening properly but it doesn't include my css file due to which a page without any css styles opens.
Options +FollowSymLinks
RewriteEngine on
RewriteRule about/(.*)/ about.php?see=$1
RewriteRule about/(.*) about.php?see=$1
Please tell me what is wrong.
Note: all files of my website including the CSS file are in same home directory of my website.

Related

.htaccess php seo url

i have problem with seo links
website.com/member/.htaccess code:
RewriteEngine on
RewriteBase /member/
RewriteRule ^([0-9]{1,15})-(.*).html$ profile.php?id=$1 [L,NC]
website.com/member/123-nickname.html working fine but i want that link:
website.com/member/123/nickname.html i trying this .htaccess code:
RewriteEngine on
RewriteBase /member/
RewriteRule ^([0-9]{1,15})/(.*).html$ profile.php?lookup=$1 [L,NC]
url working but website looks like without .css
how to fix problem?
My guess is that you're using relative URLs for your styles. Browser tries to find CSS file starting form the /member/123/ directory. Try setting absolute URL, or add it to a base tag: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

Amend .htaccess path rewrite to include subdirectory

I currently have the following .htaccess rewrite rule setup on my site:
RewriteEngine On
RewriteRule ^([^/d]+)/?$ index.html?id=$1 [QSA]
The rule works in such a way that if I go to the following URL:
http://example.com/dashboard
It won't try and find the dashboard directory that doesn't exist but instead it will keep the URL as is and redirect the user to the root index page. From there I just use javascript to control what view the user will see depending on what path is appended.
The code works exactly as I want it to but i've now had to move my site into a sub-directory on our server. The URL structure is now this:
http://example.com/mysubdir/dashboard
I tried rewriting my rewrite rule to incorporate the directory but have not been successful so far as i'm no .htaccess expert. I tried something along the likes of:
RewriteEngine On
RewriteRule ^([^/d]+)/mysubdir/?$ index.html?id=$1 [QSA]
Could anyone tell me how I can amend my rewrite rule to work in my sub-directory?
You were close - this should do it:
RewriteEngine On
RewriteRule ^mysubdir/([^/d]+)/?$ /mysubdir/index.html?id=$1 [QSA]
Demo here: http://htaccess.mwl.be?share=6e574cc6-90a4-54ca-b113-ce72d6eb5203

htaccess rewrite #section to /section

I have a problem with htaccess
I'm making a website for a Youtube creator and to improve my SEO I need some htaccess rule so it likes that the users vists another page (that improves Google Listing)
My website contains sections (like <section id="contact">)
I'm trying it with /contact
Rewriting website.com/#contact to website.com/contact but when I try to do so , it results in 404 (The requested URL /nieuw/contact was not found on this server.)
Currently I have a file called .htaccess (root/nieuw/.htaccess)
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^/contact$ %{HTTP_HOST}/#contact [L]
I also tried it without %{HTTP_HOST}
Directory structure:
-root
--nieuw
---index.php with sections
--oud
--.htaccess that contains `RewriteRule ^(.*)$ nieuw/$1 [L]`
(and some other stuff that isn't relevant for this question)
Can someone tell me what I do wrong and how to solve it?

.htaccess RewriteRule Redirect works on htaccess tester, does not work on server

I have an .htaccess file defined at www.mydomain/documentation/.htaccess and am trying to redirect a number of broken links to a specific page.
The .htaccess file contains the Rewrite Rule
RewriteRule ^/?(documentation/PresentationCore~System\.Windows\.RoutedEventArgs).*$
/documentation/v4.x/SciChart_WPF_v4_SDK_User_Manual.html [R,L,NC]
Note: RewriteEngine ON has already been defined. Other rules are being applied
Now in .htaccess tester the rule is being evaluated and redirects correctly when the following URL is requested:
www.mydomain.com/documentation/PresentationCore~System.Windows.RoutedEventArgs~Handled.html
However, when the same domain is entered into the browser, I get a 404 not found for this page.
I can confirm I have uploaded .htaccess to the correct folder and cleared the server cache.
Is there anything else I need to do to get this to work?
You dont need to match the folder name if htaccess is already in that folder, try :
RewriteRule ^/?(PresentationCore~System\.Windows\.RoutedEventArgs).*$
/documentation/v4.x/SciChart_WPF_v4_SDK_User_Manual.html [R,L,NC]

Problem in rewriting links with htaccess

I'm using this htaccess file to rewrite links,
RewriteEngine on
RewriteRule ^([a-zA-Z]+)$ file.php?show=$1
But I'm having problem so, when i go to the page I wanted after rewrite like this: http://somesite.com/mypage
It goes to that page successfully, but when you type a slash in the end of the link (http://somesite.com/mypage/) it doesn't open and says 404 error..
Please fix the code so I can enter pages with slashes or without
RewriteEngine on
RewriteRule ^([a-zA-Z]+)(\/)?$ file.php?show=$1

Resources